-
Notifications
You must be signed in to change notification settings - Fork 2.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixes progress display on non-color tty (#4647) #4697
Conversation
If the output does not support color, then each render of the progress bar is added to a single line, which wraps over multiple lines. As a fallback, a simple carriage return is used to move to the start of the line, and space characters to clear the line.
This change will increase the build size from 9.94 MB to 9.94 MB, an increase of 969 bytes (0%)
|
1 similar comment
This change will increase the build size from 9.94 MB to 9.94 MB, an increase of 969 bytes (0%)
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! LGTM
Works for me (#4647 reporter here)! |
@arcanis @nwholloway just updated to latest master with this commit in it. Running on a mac in my CI:
Seems like This error is on macOS 10.12, Node 8.6. |
…kg#4647) (yarnpkg#4697)" This reverts commit 4c38ca7.
I suspect that 'process.stdout.columns' is returning a negative number. I'm not sure why Node would believe it to be a tty, but not able to get the window size. @skevy Would you like to try 0ef88f7 to see if this fixes the problem for you? I would be interested in knowing what the job output in your CI environment looked like previous to my first change, and after this change. |
…kg#4647) (yarnpkg#4697)" This reverts commit 4c38ca7.
If the output does not support color, then each render of the progress bar is added to a single line, which wraps over multiple lines. As a fallback, a simple carriage return is used to move to the start of the line, and space characters to clear the line.
**Summary** My recent pull request was to improve the appearance of the progress bar for non-color terminals (PR #4697). However, @skevy reported a RangeError when running with macOS 10.12, with Node 8.6. This would have been caused by process.stdout.columns returning a negative number. In this case, this just assumes a default width of 100 characters (as in spinner-progress.js). **Test plan** I have not been able to reproduce the condition where `process.tty.columns` returns a negative number, so have verified the logic by considering key cases, e.g., `undefined > 0`, `-1 > 0`.
**Summary** My recent pull request was to improve the appearance of the progress bar for non-color terminals (PR yarnpkg#4697). However, @skevy reported a RangeError when running with macOS 10.12, with Node 8.6. This would have been caused by process.stdout.columns returning a negative number. In this case, this just assumes a default width of 100 characters (as in spinner-progress.js). **Test plan** I have not been able to reproduce the condition where `process.tty.columns` returns a negative number, so have verified the logic by considering key cases, e.g., `undefined > 0`, `-1 > 0`.
If the output does not support color, then each render of the progress bar is added to a single line, which wraps over multiple lines.
As a fallback, a simple carriage return is used to move to the start of the line, and space characters to clear the line.
Summary
This is a minor cosmetic output on the formatting of the progress output.
I came across the issue raised when looking for problems to address for Hacktoberfest.
Test plan
I verified by running
yarn check
to provide output with the progress bar under the following conditions:The output from the 3 tests can be seen in the following screenshot.
This screenshot shows the non-color test with the active progress bar.