Skip to content
Permalink
Browse files

[JENKINS-40225] single remoting call

  • Loading branch information...
blatinville committed Jan 16, 2017
1 parent 998f0bb commit 63b957b3f38e8de0ed33fe4067c1e23ecdc81ac7
Showing with 16 additions and 12 deletions.
  1. +16 −12 src/main/java/org/jenkinsci/plugins/durabletask/BourneShellScript.java
@@ -49,6 +49,8 @@
*/
public final class BourneShellScript extends FileMonitoringTask {

private static enum OsType {DARWIN, UNIX, WINDOWS}

/** Number of times we will show launch diagnostics in a newly encountered workspace before going mute to save resources. */
private static /* not final */ int NOVEL_WORKSPACE_DIAGNOSTICS_COUNT = Integer.getInteger(BourneShellScript.class.getName() + ".NOVEL_WORKSPACE_DIAGNOSTICS_COUNT", 10);
/** Number of seconds we will wait for a controller script to be launched before assuming the launch failed. */
@@ -101,11 +103,13 @@ public String getScript() {
scriptPath = shf.getRemote();
List<String> args = new ArrayList<String>();

if (!ws.act(new DarwinCheck())) { // JENKINS-25848
OsType os = ws.act(new getOsType());

if (os != OsType.DARWIN) { // JENKINS-25848
args.add("nohup");
}
if (ws.act(new WindowsCheck())) { // JENKINS-40255
scriptPath= scriptPath.replace("\\", "/"); // cygwin sh understands mixed path (ie : "c:/jenkins/workspace/script.sh" )
if (os == OsType.WINDOWS) { // JENKINS-40255
scriptPath= scriptPath.replace("\\", "/"); // cygwin sh understands mixed path (ie : "c:/jenkins/workspace/script.sh" )
}

envVars.put(cookieVariable, "please-do-not-kill-me");
@@ -221,15 +225,15 @@ private synchronized int pid(FilePath ws) throws IOException, InterruptedExcepti

}

private static final class DarwinCheck extends MasterToSlaveCallable<Boolean,RuntimeException> {
@Override public Boolean call() throws RuntimeException {
return Platform.isDarwin();
}
}
private static final class WindowsCheck extends MasterToSlaveCallable<Boolean,RuntimeException> {
@Override public Boolean call() throws RuntimeException {
return Platform.current() == Platform.WINDOWS ;
private static final class getOsType extends MasterToSlaveCallable<OsType,RuntimeException> {
@Override public OsType call() throws RuntimeException {
if (Platform.isDarwin()) {
return OsType.DARWIN;
} else if (Platform.current() == Platform.WINDOWS) {
return OsType.WINDOWS;
} else {
return OsType.UNIX; // Default Value
}
}
}

}

0 comments on commit 63b957b

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