Skip to content
Permalink
Browse files

fix JENKINS-9240

  • Loading branch information
kiy0taka
kiy0taka committed Jun 26, 2011
1 parent ca07e22 commit b28b0213ba04a0a3bc0b1724b1aea6248b3059e4
Showing with 14 additions and 7 deletions.
  1. +14 −7 src/main/java/org/jvnet/hudson/plugins/SSHBuildWrapper.java
@@ -57,28 +57,35 @@ public Environment setUp(AbstractBuild build, Launcher launcher, BuildListener l
Environment env = new Environment() {
@Override
public boolean tearDown(AbstractBuild build, BuildListener listener) throws IOException, InterruptedException {
executePostBuildScript(listener.getLogger());
if (!executePostBuildScript(listener.getLogger())) {
return false;
}
return super.tearDown(build, listener);
}
};
executePreBuildScript(listener.getLogger());
return env;
if (executePreBuildScript(listener.getLogger())) {
return env;
}
// build will fail.
return null;
}

private void executePreBuildScript(PrintStream logger) {
private boolean executePreBuildScript(PrintStream logger) {
log(logger, "executing pre build script:\n" + preScript);
SSHSite site = getSite();
if (preScript != null && !preScript.trim().equals("")) {
site.executeCommand(logger, preScript);
return site.executeCommand(logger, preScript) == 0;
}
return true;
}

private void executePostBuildScript(PrintStream logger) {
private boolean executePostBuildScript(PrintStream logger) {
log(logger, "executing post build script:\n" + postScript);
SSHSite site = getSite();
if (postScript != null && !postScript.trim().equals("")) {
site.executeCommand(logger, postScript);
return site.executeCommand(logger, postScript) == 0;
}
return true;
}

public String getPreScript() {

0 comments on commit b28b021

Please sign in to comment.
You can’t perform that action at this time.