Skip to content

Commit

Permalink
Adjusted flushing behavior of remote code using TaskListener.
Browse files Browse the repository at this point in the history
(cherry picked from commit 213cc0d)
  • Loading branch information
jglick committed Apr 2, 2019
1 parent 811583e commit 7ee034e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 4 additions & 1 deletion core/src/main/java/hudson/util/StreamCopyThread.java
Expand Up @@ -63,8 +63,11 @@ public void run() {
// it doesn't make sense not to close InputStream that's already EOF-ed,
// so there's no 'closeIn' flag.
in.close();
if(closeOut)
if (closeOut) {
out.close();
} else {
out.flush();
}
}
} catch (IOException e) {
// TODO: what to do?
Expand Down
2 changes: 1 addition & 1 deletion core/src/main/java/hudson/util/StreamTaskListener.java
Expand Up @@ -169,7 +169,7 @@ private void writeObject(ObjectOutputStream out) throws IOException {
}

private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
out = new PrintStream((OutputStream)in.readObject(),true);
out = new PrintStream((OutputStream)in.readObject(), false);
String name = (String)in.readObject();
charset = name==null ? null : Charset.forName(name);
}
Expand Down

0 comments on commit 7ee034e

Please sign in to comment.