How do I emulate os.kill() in Windows?
Use win32api:
def kill(pid): """kill function for Win32""" import win32api handle = win32api.OpenProcess(1, 0, pid) return (0 != win32api.TerminateProcess(handle, 0))
CATEGORY: windows
Use win32api:
def kill(pid): """kill function for Win32""" import win32api handle = win32api.OpenProcess(1, 0, pid) return (0 != win32api.TerminateProcess(handle, 0))
CATEGORY: windows
this page was rendered by a django application in 0.02s 2008-08-07 22:54:17.475732. hosted by webfaction.
Comment:
In 2.5, the _subprocess module exposes TerminateProcess, but I'm not sure if you can go from a PID to a process handle without OpenProcess...
Posted by Fredrik