--- a/wxPopen.py Tue Sep 02 12:24:25 2008 +0200
+++ b/wxPopen.py Wed Sep 03 17:28:17 2008 +0200
@@ -28,7 +28,8 @@
import subprocess, ctypes
import threading
import os
-from signal import SIGTERM
+if os.name == 'posix':
+ from signal import SIGTERM, SIGKILL
class outputThread(threading.Thread):
@@ -140,7 +141,7 @@
if self.finish_callback is not None:
self.finish_callback(self,ecode,pid)
- def kill(self,signal=SIGTERM):
+ def kill(self,gently=True):
self.outt.killed = True
self.errt.killed = True
if wx.Platform == '__WXMSW__':
@@ -149,8 +150,12 @@
ctypes.windll.kernel32.TerminateProcess(handle, -1)
ctypes.windll.kernel32.CloseHandle(handle)
else:
+ if gently:
+ sig=SIGTERM
+ else:
+ sig=SIGKILL
try:
- os.kill(self.Proc.pid, signal)
+ os.kill(self.Proc.pid, sig)
except:
pass
self.outt.join()