Skip to content

Commit 357847d

Browse files
committed
[JENKINS-63847] Use line separator from agent OS instead of master OS
1 parent 7b40111 commit 357847d

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

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

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444

4545
import hudson.AbortException;
4646
import io.fabric8.kubernetes.api.model.Container;
47+
import jenkins.security.MasterToSlaveCallable;
4748
import org.apache.commons.io.output.TeeOutputStream;
4849
import org.csanchez.jenkins.plugins.kubernetes.ContainerTemplate;
4950
import org.csanchez.jenkins.plugins.kubernetes.KubernetesSlave;
@@ -459,7 +460,13 @@ public void onClose(int i, String s) {
459460
}
460461
toggleStdout.disable();
461462
OutputStream stdin = watch.getInput();
462-
PrintStream in = new PrintStream(stdin, true, StandardCharsets.UTF_8.name());
463+
// Initialize a PrintStream with line separator from agent
464+
PrintStream in = pwd.getChannel().call(new MasterToSlaveCallable<PrintStream, UnsupportedEncodingException>() {
465+
@Override
466+
public PrintStream call() throws UnsupportedEncodingException {
467+
return new PrintStream(stdin, true, StandardCharsets.UTF_8.name());
468+
}
469+
});
463470
if (pwd != null) {
464471
// We need to get into the project workspace.
465472
// The workspace is not known in advance, so we have to execute a cd command.

0 commit comments

Comments
 (0)