[FIXED HUDSON-2394] Improved error handling when Maven fails to start correctly in the m2 project type.

git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@15501 71c3de6d-444a-0410-be80-ed276b4c234a
This commit is contained in:
kohsuke committed 2009-02-20 20:28:57 +00:00
1 parent 9f71682941
commit 481fd5ab2e
2 files changed
+35 -1

No files matched your search

+20
View File
@@ -49,6 +49,11 @@ import java.util.logging.Logger;
public abstract class Proc {
private Proc() {}
/**
* Checks if the process is still alive.
*/
public abstract boolean isAlive() throws IOException, InterruptedException;
/**
* Terminates the process.
*
@@ -176,6 +181,16 @@ public abstract class Proc {
}
}
@Override
public boolean isAlive() throws IOException, InterruptedException {
try {
proc.exitValue();
return false;
} catch (IllegalThreadStateException e) {
return true;
}
}
@Override
public void kill() throws InterruptedException, IOException {
destroy();
@@ -254,6 +269,11 @@ public abstract class Proc {
throw new IOException2("Failed to join the process",e);
}
}
@Override
public boolean isAlive() throws IOException, InterruptedException {
return !process.isDone();
}
}
private static final Logger LOGGER = Logger.getLogger(Proc.class.getName());