Fix another Windows peculiarity. How can anyone sane use that fscking OS?!?
This commit is contained in:
parent
5d41c6c4a8
commit
7e84cd7a1c
@ -1,4 +1,4 @@
|
|||||||
import os, subprocess, pprint, sys, shlex
|
import os, subprocess, pprint, sys, shlex, signal
|
||||||
|
|
||||||
import numpy as np
|
import numpy as np
|
||||||
from Qt import QtCore
|
from Qt import QtCore
|
||||||
@ -130,7 +130,14 @@ class PowerThread(BasePowerThread):
|
|||||||
cmdline.extend(shlex.split(additional_params))
|
cmdline.extend(shlex.split(additional_params))
|
||||||
|
|
||||||
# Start soapy_power process and close write part of pipe
|
# Start soapy_power process and close write part of pipe
|
||||||
self.process = subprocess.Popen(cmdline, close_fds=False, universal_newlines=False)
|
if sys.platform == 'win32':
|
||||||
|
creationflags = subprocess.CREATE_NEW_PROCESS_GROUP
|
||||||
|
else:
|
||||||
|
creationflags = 0
|
||||||
|
|
||||||
|
self.process = subprocess.Popen(cmdline, close_fds=False, universal_newlines=False,
|
||||||
|
creationflags=creationflags)
|
||||||
|
|
||||||
os.close(self.pipe_write_fd)
|
os.close(self.pipe_write_fd)
|
||||||
if sys.platform == 'win32':
|
if sys.platform == 'win32':
|
||||||
self.pipe_write_handle.Close()
|
self.pipe_write_handle.Close()
|
||||||
@ -140,6 +147,9 @@ class PowerThread(BasePowerThread):
|
|||||||
with self._shutdown_lock:
|
with self._shutdown_lock:
|
||||||
if self.process:
|
if self.process:
|
||||||
try:
|
try:
|
||||||
|
if sys.platform == 'win32':
|
||||||
|
self.process.send_signal(signal.CTRL_BREAK_EVENT)
|
||||||
|
else:
|
||||||
self.process.terminate()
|
self.process.terminate()
|
||||||
except ProcessLookupError:
|
except ProcessLookupError:
|
||||||
pass
|
pass
|
||||||
|
Loading…
Reference in New Issue
Block a user