You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
What I was expecting:
Everything works the same, except case 2 has a different display, since we no longer use Unicode.
What happens:
When using the builder, the default PrintStream is not System.err, but instead is
static ConsoleProgressBarConsumer createConsoleConsumer(int predefinedWidth) {
PrintStream real = new PrintStream(new FileOutputStream(FileDescriptor.err));
return createConsoleConsumer(real, predefinedWidth); // System.err might be overridden by System.setErr
}
(see Utils.java, line 20-23)
Why this may be a problem:
My code redirects certain streams (typically System.err) to other streams, and hence uses System.setErr() to redirect it. Because of this inconsistency, I can no longer do so.
Additionally, I am uncertain as to what benefits you gain from instantiating the PrintStream the way you do so in the above code, as opposed to using System.err directly.
What can easily be done :)
Would you be open to changing PrintStream real = new PrintStream(new FileOutputStream(FileDescriptor.err));
with PrintStream real = System.err;
This would make the whole code consistent. Let me know what you think and if you want me to make a pull request for this change!
Best,
Nathan
The text was updated successfully, but these errors were encountered:
Thanks Nathan! I think this deliberate choice of instantiating from FileDescriptor.err is to force it to display it on the screen, if stderr is used for something else (which is likely when used within a build system). Maybe we could add a switch somewhere so that the stream can be customized?
I am experiencing different program behaviour when running this code
ProgressBar pb = new ProgressBar(name, 100);
or this code:
ProgressBar.builder().setTaskName(progressBarName).setInitialMax(progressBarMaxCapacity).setStyle(ProgressBarStyle.ASCII).build();
What I was expecting:
Everything works the same, except case 2 has a different display, since we no longer use Unicode.
What happens:
When using the builder, the default PrintStream is not
System.err
, but instead is(see Utils.java, line 20-23)
Why this may be a problem:
My code redirects certain streams (typically System.err) to other streams, and hence uses System.setErr() to redirect it. Because of this inconsistency, I can no longer do so.
Additionally, I am uncertain as to what benefits you gain from instantiating the PrintStream the way you do so in the above code, as opposed to using System.err directly.
What can easily be done :)
Would you be open to changing
PrintStream real = new PrintStream(new FileOutputStream(FileDescriptor.err));
with
PrintStream real = System.err;
This would make the whole code consistent. Let me know what you think and if you want me to make a pull request for this change!
Best,
Nathan
The text was updated successfully, but these errors were encountered: