Skip to content

Commit bf74076

Browse files
committed
Remove fragile condition
1 parent 18d73fb commit bf74076

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

src/main/java/org/csanchez/jenkins/plugins/kubernetes/pipeline/ContainerExecDecorator.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -460,12 +460,11 @@ public void onClose(int i, String s) {
460460
toggleStdout.disable();
461461
OutputStream stdin = watch.getInput();
462462
PrintStream in = new PrintStream(stdin, true, StandardCharsets.UTF_8.name());
463-
boolean windows = sh.equals("cmd");
464463
if (pwd != null) {
465464
// We need to get into the project workspace.
466465
// The workspace is not known in advance, so we have to execute a cd command.
467466
in.print(String.format("cd \"%s\"", pwd));
468-
in.print(newLine(windows));
467+
in.print(newLine(!launcher.isUnix()));
469468
}
470469

471470
EnvVars envVars = new EnvVars();
@@ -492,9 +491,9 @@ public void onClose(int i, String s) {
492491

493492
LOGGER.log(Level.FINEST, "Launching with env vars: {0}", envVars.toString());
494493

495-
setupEnvironmentVariable(envVars, in, windows);
494+
setupEnvironmentVariable(envVars, in, !launcher.isUnix());
496495

497-
doExec(in, windows, printStream, masks, commands);
496+
doExec(in, !launcher.isUnix(), printStream, masks, commands);
498497

499498
LOGGER.log(Level.INFO, "Created process inside pod: [" + getPodName() + "], container: ["
500499
+ containerName + "]" + "[" + TimeUnit.NANOSECONDS.toMillis(System.nanoTime() - startMethod) + " ms]");

0 commit comments

Comments
 (0)