Commit c535896b authored by Remi Perenon's avatar Remi Perenon

Asynchronous call to subprocess

parent 9b92672d
......@@ -93,14 +93,22 @@ class JobPlugin(ComponentPlugin):
os.close(handle)
self._job.save(filename, parameters)
try:
from subprocess import DEVNULL
except ImportError:
DEVNULL = os.open(os.devnull, os.O_RDWR)
if PLATFORM.name == "windows":
startupinfo = subprocess.STARTUPINFO()
startupinfo.dwFlags |= subprocess.STARTF_USESHOWWINDOW
startupinfo.wShowWindow = subprocess.SW_HIDE
else:
startupinfo = None
#try:
# from subprocess import DEVNULL
#except ImportError:
# DEVNULL = os.open(os.devnull, os.O_RDWR)
try:
subprocess.check_output([sys.executable, filename], stdin=DEVNULL, stderr=DEVNULL)
subprocess.Popen([sys.executable, filename], startupinfo=startupinfo, stdin=subprocess.PIPE,stdout=subprocess.PIPE, stderr=subprocess.PIPE)
except subprocess.CalledProcessError as e:
message = e.output
else:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment