-
Notifications
You must be signed in to change notification settings - Fork 110
Description
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
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