From bb42124a87393fa86288ad8f4079158183683f8f Mon Sep 17 00:00:00 2001 From: Lex Neva Date: Thu, 22 Feb 2018 23:06:27 -0500 Subject: Windows fixes (#83) * os.execv doesn't replace the process on windows * fix simulate/params crash * pyinstaller windowed mode breaks things? * fix output routing for windows * properly route stderr to inkscape too * don't print unless there's something to print * remove last backup version if necessary * add documentation for Windows build --- stub.py | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'stub.py') diff --git a/stub.py b/stub.py index 9fa33160..850cfe40 100644 --- a/stub.py +++ b/stub.py @@ -2,6 +2,7 @@ import sys import os +import subprocess # ink/stitch # @@ -27,4 +28,17 @@ binary_path = os.path.join("inkstitch", "bin", binary_name) args = sys.argv[:] args[0] = binary_path -os.execv(binary_path, args) +# os.execve works here for Linux, but only this seems to get the +# extension output to Inkscape on Windows +extension = subprocess.Popen(args, stdout=subprocess.PIPE, stderr=subprocess.PIPE) +stdout, stderr = extension.communicate() + +stdout = stdout.strip() +if stdout: + print stdout.strip(), + +stderr = stderr.strip() +if stderr: + print >> sys.stderr, stderr.strip(), + +sys.exit(extension.returncode) -- cgit v1.2.3