diff --git a/core/src/main/java/hudson/Launcher.java b/core/src/main/java/hudson/Launcher.java index 1098f66ac5..f681cedc09 100644 --- a/core/src/main/java/hudson/Launcher.java +++ b/core/src/main/java/hudson/Launcher.java @@ -250,7 +250,11 @@ public abstract class Launcher { public Integer call() throws IOException { Proc p = new LocalLauncher(TaskListener.NULL).launch(cmd, env, in, out, workDir ==null ? null : new FilePath(new File(workDir))); - return p.join(); + try { + return p.join(); + } catch (InterruptedException e) { + return -1; + } } private static final long serialVersionUID = 1L; diff --git a/core/src/main/java/hudson/Proc.java b/core/src/main/java/hudson/Proc.java index e6f454671c..04e5e9b34e 100644 --- a/core/src/main/java/hudson/Proc.java +++ b/core/src/main/java/hudson/Proc.java @@ -32,7 +32,7 @@ public abstract class Proc { * if there's an error killing a process * and a stack trace could help the trouble-shooting. */ - public abstract void kill() throws IOException; + public abstract void kill() throws IOException, InterruptedException; /** * Waits for the completion of the process. @@ -46,7 +46,7 @@ public abstract class Proc { * if there's an error launching/joining a process * and a stack trace could help the trouble-shooting. */ - public abstract int join() throws IOException; + public abstract int join() throws IOException, InterruptedException; /** * Locally launched process. @@ -96,7 +96,7 @@ public abstract class Proc { * Waits for the completion of the process. */ @Override - public int join() { + public int join() throws InterruptedException { try { t1.join(); t2.join(); @@ -104,12 +104,12 @@ public abstract class Proc { } catch (InterruptedException e) { // aborting. kill the process proc.destroy(); - return -1; + throw e; } } @Override - public void kill() { + public void kill() throws InterruptedException { proc.destroy(); join(); } @@ -160,19 +160,19 @@ public abstract class Proc { } @Override - public void kill() throws IOException { + public void kill() throws IOException, InterruptedException { process.cancel(true); join(); } @Override - public int join() throws IOException { + public int join() throws IOException, InterruptedException { try { return process.get(); } catch (InterruptedException e) { // aborting. kill the process process.cancel(true); - return -1; + throw e; } catch (ExecutionException e) { if(e.getCause() instanceof IOException) throw (IOException)e.getCause(); diff --git a/core/src/main/java/hudson/model/AbstractBuild.java b/core/src/main/java/hudson/model/AbstractBuild.java index 4db3388813..51ea34a81c 100644 --- a/core/src/main/java/hudson/model/AbstractBuild.java +++ b/core/src/main/java/hudson/model/AbstractBuild.java @@ -134,7 +134,7 @@ public abstract class AbstractBuild

,R extends Abs return Result.SUCCESS; } - private void createLastSuccessfulLink(BuildListener listener) { + private void createLastSuccessfulLink(BuildListener listener) throws InterruptedException { if(!isWindows()) { try { // ignore a failure. diff --git a/core/src/main/java/hudson/model/Run.java b/core/src/main/java/hudson/model/Run.java index 6217423d1b..6ffb05ad8d 100644 --- a/core/src/main/java/hudson/model/Run.java +++ b/core/src/main/java/hudson/model/Run.java @@ -36,6 +36,7 @@ import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.logging.Logger; +import java.util.logging.Level; /** * A particular execution of {@link Job}. @@ -563,6 +564,11 @@ public abstract class Run ,RunT extends Run env = createEnvVarMap(true); int r = launcher.launch(cmd.toCommandArray(),env,out,dir).join(); @@ -752,7 +752,7 @@ public class CVSSCM extends SCM implements Serializable { return r==0; } - protected final boolean run(Launcher launcher, ArgumentListBuilder cmd, TaskListener listener, FilePath dir) throws IOException { + protected final boolean run(Launcher launcher, ArgumentListBuilder cmd, TaskListener listener, FilePath dir) throws IOException, InterruptedException { return run(launcher,cmd,listener,dir,listener.getLogger()); } @@ -912,7 +912,7 @@ public class CVSSCM extends SCM implements Serializable { /** * Displays "cvs --version" for trouble shooting. */ - public void doVersion(StaplerRequest req, StaplerResponse rsp) throws IOException, ServletException { + public void doVersion(StaplerRequest req, StaplerResponse rsp) throws IOException, ServletException, InterruptedException { ByteBuffer baos = new ByteBuffer(); try { Proc proc = Hudson.getInstance().createLauncher(TaskListener.NULL).launch( @@ -1037,7 +1037,7 @@ public class CVSSCM extends SCM implements Serializable { * TODO: this apparently doesn't work. Probably related to the fact that * cvs does some tty magic to disable echo back or whatever. */ - public void doPostPassword(StaplerRequest req, StaplerResponse rsp) throws IOException { + public void doPostPassword(StaplerRequest req, StaplerResponse rsp) throws IOException, InterruptedException { if(!Hudson.adminCheck(req,rsp)) return; diff --git a/core/src/main/java/hudson/tasks/Ant.java b/core/src/main/java/hudson/tasks/Ant.java index c667cbaf16..f69bee5302 100644 --- a/core/src/main/java/hudson/tasks/Ant.java +++ b/core/src/main/java/hudson/tasks/Ant.java @@ -68,7 +68,7 @@ public class Ant extends Builder { return antOpts; } - public boolean perform(Build build, Launcher launcher, BuildListener listener) { + public boolean perform(Build build, Launcher launcher, BuildListener listener) throws InterruptedException { Project proj = build.getProject(); ArgumentListBuilder args = new ArgumentListBuilder(); diff --git a/core/src/main/java/hudson/tasks/BuildWrapper.java b/core/src/main/java/hudson/tasks/BuildWrapper.java index 0238d9960d..7468aa0e80 100644 --- a/core/src/main/java/hudson/tasks/BuildWrapper.java +++ b/core/src/main/java/hudson/tasks/BuildWrapper.java @@ -79,7 +79,7 @@ public abstract class BuildWrapper implements ExtensionPoint, Describable