This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 269042 - Output window is displaying stdout and stderr out of order
Summary: Output window is displaying stdout and stderr out of order
Status: NEW
Alias: None
Product: ide
Classification: Unclassified
Component: UI (show other bugs)
Version: 8.2
Hardware: PC Linux
: P2 normal (vote)
Assignee: issues@ide
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-11-19 11:17 UTC by atomsymbol
Modified: 2016-11-19 11:18 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description atomsymbol 2016-11-19 11:17:00 UTC
The output window (Ctrl+4) is not displaying stdout and stderr in the order of calls to System.out.println() and System.err.println().

System.{out,err}.flush() has no effect on the displayed content.

Test program:

  public class Main {
    public static void main(String[] args) {
      for(int i=0; i<2; i++) System.out.println("stdout");
      for(int i=0; i<2; i++) System.err.println("stderr");
    }
  }

Content displayed in the output window:

  run:
  stdout
  stderr
  stdout
  stderr
  BUILD SUCCESSFUL (total time: 0 seconds)

Expected content of the output window:

  run:
  stdout
  stdout
  stderr
  stderr
  BUILD SUCCESSFUL (total time: 0 seconds)

Suggested solution:

Netbeans should use a single Linux file to read the program's outputs. In C/C++ world, this would mean that read(1, stdout_buf, size) and read(2, stderr_buf, size) read from the same underlying file. Linux man pages: dup2.

----

Related bugs: bug 202545 - not a duplicate of this bug because it targets the BlueJ component and because it is old