Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[JENKINS-12387] Use the right launcher.
I'm not sure what this code was doing here to begin with - but it was causing
intermittent errors when the node we last built on is different from the node
we're supposed to build on.
  • Loading branch information
jorgenpt committed Jan 19, 2012
1 parent 025d3af commit d1f1a0c
Showing 1 changed file with 1 addition and 13 deletions.
Expand Up @@ -83,17 +83,6 @@ public String[] getBuildStepArgs() {
return buildStepArgs;
}

private Launcher getLastBuiltLauncher(AbstractBuild<?, ?> build, Launcher launcher, BuildListener listener) {
AbstractProject<?, ?> project = build.getProject();
Node lastBuiltOn = project.getLastBuiltOn();
Launcher lastBuiltLauncher = launcher;
if (lastBuiltOn != null) {
lastBuiltLauncher = lastBuiltOn.createLauncher(listener);
}

return lastBuiltLauncher;
}

/**
* Perform the build step on the execution host.
* <p>
Expand All @@ -114,7 +103,6 @@ public boolean perform(AbstractBuild<?, ?> build, Launcher launcher, BuildListen
try {
FilePath workingDir = build.getWorkspace();
EnvVars env = build.getEnvironment(listener);
Launcher lastBuiltLauncher = getLastBuiltLauncher(build, launcher, listener);
String data = buildStepConfig.content;

/*
Expand Down Expand Up @@ -160,7 +148,7 @@ public boolean perform(AbstractBuild<?, ?> build, Launcher launcher, BuildListen
* Execute command remotely
*/
listener.getLogger().println("Executing temp file '" + dest.getRemote() + "'");
int r = lastBuiltLauncher.launch().cmds(args).envs(env).stderr(listener.getLogger()).stdout(listener.getLogger()).pwd(workingDir).join();
int r = launcher.launch().cmds(args).envs(env).stderr(listener.getLogger()).stdout(listener.getLogger()).pwd(workingDir).join();
returnValue = (r == 0);

} catch (IOException e) {
Expand Down

0 comments on commit d1f1a0c

Please sign in to comment.