Last 12 weeks · 4 commits
4 of 6 standards met
There is a bug where an infinite loop occurs when the TTY width is 0. This is mainly reproducible via run in a non-terminal context, which attaches a width-0 TTY to its child. For example, the Bash tool of coding agents runs in a non-terminal context. I found this issue while trying to inspect the escape sequences emitted by the spinner in a coding agent. Since the log is written to rapidly and consumes disk space, run the reproduction under something like .
When the spinner text contains an OSC 8 hyperlink whose URI contains certain characters (described below) and is longer than the terminal width, every repaint erases lines printed above the spinner. Expected: the three logged lines stay on screen. Actual: they are erased one by one while the spinner runs. measures the text with . Its OSC pattern accepts only for the URI, so it should abort at the first byte outside that set and leave the rest of the URI in the measured string. That class omits ten characters that RFC 3986 permits in a URI without percent-encoding: , , , , , , , , , and . As a result, the line count most likely comes out too large, and erases that many rows above the spinner.
This adds a option to . By default, the current behavior is unchanged: when a spinner is active, it subscribes to and , stops the spinner, and exits the process. When is passed, the spinner no longer subscribes to those process-level signal handlers. This is useful for applications that embed but need to manage process signals themselves. Changes Add to the public options type. Default to to preserve existing behavior. Skip subscribing and unsubscribing / handlers when is . Document the new option in the README. Add tests covering the default behavior and the opt-out behavior. Verified locally.
Repository: sindresorhus/yocto-spinner. Description: Tiny terminal spinner Stars: 313, Forks: 13. Primary language: JavaScript. Languages: JavaScript (100%). License: MIT. Latest release: v1.2.2 (1mo ago). Open PRs: 1, open issues: 0. Last activity: 1mo ago. Community health: 71%. Top contributors: sindresorhus, lumirlumir, dumbmatter, u1f992, yminod.