Skip to content

Commit

Permalink
[FIXED JENKINS-8420] recording 3c5c2c5
Browse files Browse the repository at this point in the history
  • Loading branch information
kohsuke committed Feb 14, 2011
1 parent 3c5c2c5 commit 8b41031
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
3 changes: 3 additions & 0 deletions changelog.html
Expand Up @@ -58,6 +58,9 @@
<!-- Record your changes in the trunk here. -->
<div id="trunk" style="display:none"><!--=TRUNK-BEGIN=-->
<ul class=image>
<li class='major bug'>
On IBM JDKs, Jenkins incorrectly ended up closing stdout to read from forked processes.
(<a href="http://issues.jenkins-ci.org/browse/JENKINS-8420">issue 8420</a>)
<li class=bug>
Jenkins was unable to kill/list up native processses on 64bit Mac JVMs.
<li class=bug>
Expand Down
10 changes: 5 additions & 5 deletions core/src/main/java/hudson/Proc.java
Expand Up @@ -202,12 +202,12 @@ private LocalProc( String name, ProcessBuilder procBuilder, InputStream in, Outp
copier2 = new StreamCopyThread(name+": stderr copier", procErrorStream, err);
copier2.start();
} else {
// On IBM JDK5, returned input and error streams might be the same.
// So, in this case, closing one isn't a good idea since it will close both.
// the javadoc is unclear about what getErrorStream() returns when ProcessBuilder.redirectErrorStream(true),
//
// according to the source code, Sun JREs still still returns a distinct reader end of a pipe that needs to be closed.
// but apparently at least on some IBM JDK5, returned input and error streams are the same.
// so try to close them smartly
if (procErrorStream!=procInputStream) {
// while this is not discussed in javadoc, even with ProcessBuilder.redirectErrorStream(true),
// Process.getErrorStream() still returns a distinct reader end of a pipe that needs to be closed.
// this is according to the source code of HotSpot JVM
procErrorStream.close();
}
copier2 = null;
Expand Down

0 comments on commit 8b41031

Please sign in to comment.