Skip to content

Commit a392521

Browse files
committed
fix #309
1 parent 17e3636 commit a392521

1 file changed

Lines changed: 14 additions & 2 deletions

File tree

pythonFiles/PythonTools/visualstudio_py_testlauncher.py

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,13 @@ def sendResult(self, test, outcome, trace = None):
177177
)
178178

179179
def stopTests():
180-
os.kill(os.getpid(), signal.SIGUSR1)
180+
try:
181+
os.kill(os.getpid(), signal.SIGUSR1)
182+
except:
183+
try:
184+
os.kill(os.getpid(), signal.SIGTERM)
185+
except:
186+
pass
181187

182188
class ExitCommand(Exception):
183189
pass
@@ -209,7 +215,13 @@ def main():
209215

210216
sys.path[0] = os.getcwd()
211217
if opts.result_port:
212-
signal.signal(signal.SIGUSR1, signal_handler)
218+
try:
219+
signal.signal(signal.SIGUSR1, signal_handler)
220+
except:
221+
try:
222+
signal.signal(signal.SIGTERM, signal_handler)
223+
except:
224+
pass
213225
_channel = _IpcChannel(socket.create_connection(('127.0.0.1', opts.result_port)), stopTests)
214226
sys.stdout = _TestOutput(sys.stdout, is_stdout = True)
215227
sys.stderr = _TestOutput(sys.stderr, is_stdout = False)

0 commit comments

Comments
 (0)