wizards/source/scriptforge/python/scriptforge.py |    3 +++
 1 file changed, 3 insertions(+)

New commits:
commit 4cb73b7a5792b6c8fabacc1e29d67e9f254144e8
Author:     Jean-Pierre Ledure <j...@ledure.be>
AuthorDate: Fri May 21 15:54:10 2021 +0200
Commit:     Jean-Pierre Ledure <j...@ledure.be>
CommitDate: Fri May 21 18:13:32 2021 +0200

    ScriptForge - (scriptforge.py) FIX stdout redirection in PythonShell()
    
    Previous behavior:
      After a PythonShell() statement that opened the APSO shell console,
      subsequent print() statements executed in the same macro
      run were not displayed in the console.
      They were only from a next macro run.
    
    Solution:
      Force a brief suspension of the Python process by inserting
      a call to a Basic routine (IPC) immediately after the launch
      of the shell console.
    
    Result: The redirection of STDOUT and STDERR happens normally inside
      the APSO code, as expected.
    Change-Id: Ifbf267a898d45a97c346f0f3ea824edd4e6045ff
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115930
    Tested-by: Jean-Pierre Ledure <j...@ledure.be>
    Tested-by: Jenkins
    Reviewed-by: Jean-Pierre Ledure <j...@ledure.be>

diff --git a/wizards/source/scriptforge/python/scriptforge.py 
b/wizards/source/scriptforge/python/scriptforge.py
index 359db7a42ec1..bb8635936ed5 100644
--- a/wizards/source/scriptforge/python/scriptforge.py
+++ b/wizards/source/scriptforge/python/scriptforge.py
@@ -942,6 +942,9 @@ class SFScriptForge:
                 kwargs = {'loc': variables}
                 kwargs['loc'].setdefault('XSCRIPTCONTEXT', uno)
                 console(**kwargs)
+                # An interprocess call is necessary to allow a redirection of 
STDOUT and STDERR by APSO
+                #   Choice is a minimalist call to a Basic routine: no 
arguments, a few lines of code
+                SFScriptForge.SF_Basic.GetGuiType()
             else:
                 # The APSO extension could not be located in your LibreOffice 
installation
                 cls._RaiseFatal('SF_Exception.PythonShell', 'variables=None', 
'PYTHONSHELLERROR')
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to