Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-53586

Launcher.ProcStarter.readStderr() has no effect

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Major Major
    • core
    • None

      Hi,
      I found Launcher.ProcStarter.readStderr() has no effect when developing a Jenkins plugin.
      After calling `readStderr`, the stderr of the remote process is still merged to `stdout` while `Proc.getStderr()` will always get a stream with empty content.

      I currently don't have time to look at the code carefully or fix it, but I guess it is caused by the following reason:

      What readStderr() does is just setting `reverseStderr` to true, resulting in the err parameter passed to LocalProc is set to LocalProc.SELFPUMP_OUTPUT (
      https://github.com/jenkinsci/jenkins/blob/stable-2.138/core/src/main/java/hudson/Launcher.java#L934), otherwise err parameter will be set to null. But the construct of LocalProc will set the redirectError parameter of ProcessBuilder to true in both cases (https://github.com/jenkinsci/jenkins/blob/stable-2.138/core/src/main/java/hudson/Proc.java#L219).

      If my understanding is correct, the `redirectError` parameter should be set to true only when `err == null`.

            kohsuke Kohsuke Kawaguchi
            vfreex Yuxiang Zhu
            Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: