summaryrefslogtreecommitdiff
path: root/wizards
diff options
context:
space:
mode:
authorJean-Pierre Ledure <jp@ledure.be>2021-05-21 15:54:10 +0200
committerJean-Pierre Ledure <jp@ledure.be>2021-05-21 18:13:32 +0200
commit4cb73b7a5792b6c8fabacc1e29d67e9f254144e8 (patch)
treebebf8d75f60b4123dd22112c3104a4b14be4aed7 /wizards
parent45a49b7a1b552f204e7b417cfbe2d86e4b169993 (diff)
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 <jp@ledure.be> Tested-by: Jenkins Reviewed-by: Jean-Pierre Ledure <jp@ledure.be>
Diffstat (limited to 'wizards')
-rw-r--r--wizards/source/scriptforge/python/scriptforge.py3
1 files changed, 3 insertions, 0 deletions
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')