integrated winp so that Hudson can kill processes recursively on Windows.

git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@7016 71c3de6d-444a-0410-be80-ed276b4c234a
This commit is contained in:
kohsuke committed 2008-02-08 06:17:02 +00:00
1 parent 66f9720fde
commit bda15d2acb
4 files changed
+31 -4

No files matched your search

+15 -2
View File
@@ -3,6 +3,7 @@ package hudson;
import hudson.remoting.Channel;
import hudson.util.IOException2;
import hudson.util.StreamCopyThread;
import hudson.model.Hudson;
import java.io.File;
import java.io.IOException;
@@ -14,6 +15,8 @@ import java.util.concurrent.Future;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.jvnet.winp.WinProcess;
/**
* External process wrapper.
*
@@ -144,17 +147,27 @@ public abstract class Proc {
return r;
} catch (InterruptedException e) {
// aborting. kill the process
proc.destroy();
destroy();
throw e;
}
}
@Override
public void kill() throws InterruptedException, IOException {
proc.destroy();
destroy();
join();
}
/**
* Destroys the child process without join.
*/
private void destroy() {
if(Hudson.isWindows())
new WinProcess(proc).killRecursively();
else
proc.destroy();
}
private static class ByteCopier extends Thread {
private final InputStream in;
private final OutputStream out;