Skip to content
Permalink
Browse files

[FIXED JENKINS-25848] Skip nohup on Mac OS X, since it fails under so…

…me conditions.
  • Loading branch information...
jglick committed Dec 3, 2014
1 parent a655dc3 commit 1957d3f51292b3e10e38ea9a400dcb8fa394d029
Showing with 18 additions and 3 deletions.
  1. +18 −3 src/main/java/org/jenkinsci/plugins/durabletask/BourneShellScript.java
@@ -28,11 +28,15 @@
import hudson.Extension;
import hudson.FilePath;
import hudson.Launcher;
import hudson.Platform;
import hudson.Util;
import hudson.model.TaskListener;
import java.io.IOException;

import hudson.remoting.Callable;
import hudson.tasks.Shell;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import javax.annotation.Nonnull;
import jenkins.model.Jenkins;
import org.kohsuke.stapler.DataBoundConstructor;
@@ -76,7 +80,12 @@ public String getScript() {
c.getResultFile(ws)
)./* escape against EnvVars jobEnv in LocalLauncher.launch */replace("$", "$$");

Launcher.ProcStarter ps = launcher.launch().cmds("nohup", "sh", "-c", cmd).envs(envVars).pwd(ws);
List<String> args = new ArrayList<String>();
if (!ws.act(new DarwinCheck())) { // JENKINS-25848
args.add("nohup");
}
args.addAll(Arrays.asList("sh", "-c", cmd));
Launcher.ProcStarter ps = launcher.launch().cmds(args).envs(envVars).pwd(ws);
try {
Launcher.ProcStarter.class.getMethod("quiet", boolean.class).invoke(ps, true); // TODO 1.576+ remove reflection
listener.getLogger().println("[" + ws.getRemote().replaceFirst("^.+/", "") + "] Running shell script"); // -x will give details
@@ -152,4 +161,10 @@ private synchronized int pid(FilePath ws) throws IOException, InterruptedExcepti

}

private static final class DarwinCheck implements Callable<Boolean,RuntimeException> {
@Override public Boolean call() throws RuntimeException {
return Platform.isDarwin();
}
}

}

0 comments on commit 1957d3f

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