Skip to content

Commit 6b13c6d

Browse files
authored
Merge pull request #40 from jenkinsci/JENKINS-54929-fix-output-issue
[JENKINS-54929] Always flush the output logger on the TaskListener
2 parents 431aa39 + 3a7342d commit 6b13c6d

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

src/main/java/org/jenkinsci/plugins/ansible/CLIRunner.java

+13-5
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package org.jenkinsci.plugins.ansible;
22

33
import java.io.IOException;
4+
import java.io.PrintStream;
45
import java.util.Map;
56

67
import hudson.FilePath;
@@ -42,10 +43,17 @@ public CLIRunner(Run<?, ?> build, FilePath ws, Launcher launcher, TaskListener l
4243
public boolean execute(ArgumentListBuilder args, Map<String, String> environment)
4344
throws IOException, InterruptedException
4445
{
45-
return launcher.launch()
46-
.pwd(ws)
47-
.envs(environment)
48-
.cmds(args)
49-
.stdout(listener).join() == 0;
46+
PrintStream logger = listener.getLogger();
47+
try {
48+
return launcher.launch()
49+
.pwd(ws)
50+
.envs(environment)
51+
.cmds(args)
52+
.stdout(logger)
53+
.stderr(logger).join() == 0;
54+
}
55+
finally {
56+
logger.flush();
57+
}
5058
}
5159
}

0 commit comments

Comments
 (0)