summaryrefslogtreecommitdiff
path: root/stub.py
diff options
context:
space:
mode:
authorLex Neva <lexelby@users.noreply.github.com>2018-02-22 23:06:27 -0500
committerGitHub <noreply@github.com>2018-02-22 23:06:27 -0500
commitbb42124a87393fa86288ad8f4079158183683f8f (patch)
treeefd8a5a216ffe41ba4b2c90b0ca8721dc953b7de /stub.py
parent48e5d628a8f49b0ff7e6db3d91b3b91f4a1af91a (diff)
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
Diffstat (limited to 'stub.py')
-rw-r--r--stub.py16
1 files changed, 15 insertions, 1 deletions
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)