diff --git a/src/com/sheepit/client/os/windows/WinProcess.java b/src/com/sheepit/client/os/windows/WinProcess.java index 6cdc113..2cbe9f5 100644 --- a/src/com/sheepit/client/os/windows/WinProcess.java +++ b/src/com/sheepit/client/os/windows/WinProcess.java @@ -96,7 +96,7 @@ public class WinProcess { @Override protected void finalize() throws Throwable { if (this.handle != null) { - Kernel32.INSTANCE.CloseHandle(this.handle); + // Kernel32.INSTANCE.CloseHandle(this.handle); // do not close the handle because the parent Process object might still alive this.handle = null; } this.pid = -1; @@ -123,6 +123,7 @@ public class WinProcess { private void terminate() { Kernel32.INSTANCE.TerminateProcess(this.handle, 0); + Kernel32.INSTANCE.CloseHandle(this.handle); // we are sure that the parent Process object is dead } private List getChildren() throws IOException {