提交 93db0d11 编写于 作者: K Kohsuke Kawaguchi

added a hook for use cases like https://github.com/jenkinsci/jenkins/pull/1079

上级 1fda95b6
......@@ -25,11 +25,14 @@ package hudson.tasks;
import hudson.FilePath;
import hudson.Launcher;
import hudson.Launcher.ProcStarter;
import hudson.Proc;
import hudson.Util;
import hudson.EnvVars;
import hudson.model.AbstractBuild;
import hudson.model.BuildListener;
import hudson.model.Node;
import hudson.model.Result;
import hudson.model.TaskListener;
import hudson.remoting.ChannelClosedException;
......@@ -91,7 +94,7 @@ public abstract class CommandInterpreter extends Builder {
for(Map.Entry<String,String> e : build.getBuildVariables().entrySet())
envVars.put(e.getKey(),e.getValue());
r = launcher.launch().cmds(buildCommandLine(script)).envs(envVars).stdout(listener).pwd(ws).join();
r = join(launcher.launch().cmds(buildCommandLine(script)).envs(envVars).stdout(listener).pwd(ws).start());
} catch (IOException e) {
Util.displayIOException(e, listener);
e.printStackTrace(listener.fatalError(Messages.CommandInterpreter_CommandFailed()));
......@@ -121,6 +124,19 @@ public abstract class CommandInterpreter extends Builder {
}
}
/**
* Reports the exit code from the process.
*
* This allows subtypes to treat the exit code differently (for example by treating non-zero exit code
* as if it's zero, or to set the status to {@link Result#UNSTABLE}). Any non-zero exit code will cause
* the build step to fail.
*
* @since 1.549
*/
protected int join(Proc p) throws IOException, InterruptedException {
return p.join();
}
/**
* Creates a script file in a temporary name in the specified directory.
*/
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册