Skip to content

Conversation

cp90-pixel
Copy link

Summary

  • avoid clearing the terminal when the progress spinner resumes without having rendered
  • add a regression test covering npm run scripts that finish without a trailing newline

Testing

@cp90-pixel cp90-pixel requested a review from a team as a code owner October 1, 2025 21:59
@wraithgar wraithgar self-assigned this Oct 2, 2025
@wraithgar
Copy link
Member

This code doesn't fix the problem when I test it locally.

$ node . run start --prefix=/Users/wraithgar/Development/scratch/run

> start
> printf 'this output will vanish'; sleep 3

~/D/n/c/b/main (gar/pr8631|✔) $

All this appears to do is delay the bug by one frame, the first resumed frame of the spinner will end up at the end of the npm run output, but the very next one will still rewrite the entire line.

wraithgar added a commit that referenced this pull request Oct 2, 2025
 - inline this.#render logic.  The initial setTimeout is only used during load(), so run it there instead.
 - .unref() the progress bar's recurring timeout object
 - reuse the progress bar's timeout object with .refresh() instead of making a new one every frame
 - consolidate comments into one line and remove stale comments
 - skip clearing the line on the first frame when resuming the spinner
 - removed the test from $8631 as it was only testing that the very first frame of the spinner didn't clear the line, not any subsequent frames

This is built off of #8631, moving the "skip clearing the line..." logic into a flag that's passed during .resume()
wraithgar added a commit that referenced this pull request Oct 2, 2025
 - inline this.#render logic.  The initial setTimeout is only used during load(), so run it there instead.
 - .unref() the progress bar's recurring timeout object
 - reuse the progress bar's timeout object with .refresh() instead of making a new one every frame
 - consolidate comments into one line and remove stale comments
 - skip clearing the line on the first frame when resuming the spinner
 - removed the test from $8631 as it was only testing that the very first frame of the spinner didn't clear the line, not any subsequent frames

This is built off of #8631, moving the "skip clearing the line..." logic into a flag that's passed during .resume()
wraithgar added a commit that referenced this pull request Oct 2, 2025
 - inline this.#render logic.  The initial setTimeout is only used during load(), so run it there instead.
 - .unref() the progress bar's recurring timeout object
 - reuse the progress bar's timeout object with .refresh() instead of making a new one every frame
 - consolidate comments into one line and remove stale comments
 - skip clearing the line on the first frame when resuming the spinner
 - removed the test from $8631 as it was only testing that the very first frame of the spinner didn't clear the line, not any subsequent frames

This is built off of #8631, moving the "skip clearing the line..." logic into a flag that's passed during .resume()
@wraithgar
Copy link
Member

I spent quite a bit of time in the progress indicator code last night and did some cleanup. I think the "don't clear progress on resume" is still a valid thing to do so I kept it, moving it into the resume function.

#8633

@wraithgar wraithgar closed this Oct 2, 2025
@cp90-pixel cp90-pixel deleted the issue#8583 branch October 4, 2025 18:00
wraithgar added a commit that referenced this pull request Oct 6, 2025
- inline this.#render logic. The initial setTimeout is only used during
load(), so run it there instead.
 - .unref() the progress bar's recurring timeout object
- reuse the progress bar's timeout object with .refresh() instead of
making a new one every frame
 - Minor comment syntax cleanup and remove stale comments
 - skip clearing the line on the first frame when resuming the spinner
- removed the test from #8631 as it was only testing that the very first
frame of the spinner didn't clear the line, not any subsequent frames
    
This is built off of #8631, moving the
"skip clearing the line..." logic into a flag that's passed during
.resume()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants