- 
                Notifications
    
You must be signed in to change notification settings  - Fork 151
 
Description
Environment
- OS: Windows 11 (MSYS_NT-10.0-26100)
 - Node Version: v22.20.0
 - Package: @clack/prompts
 - Package Version: v1.0.0-alpha.6
 
Describe the bug
After calling spinner.stop(), stdin remains in raw mode on Windows, preventing Ctrl+C from generating SIGINT signals. This breaks signal handling for any code that runs after the spinner stops.
The root cause is in the block() function's cleanup code, which intentionally skips restoring raw mode on Windows to prevent issue #176:
// From clack source - block() cleanup
if (input instanceof ReadStream && input.isTTY && !isWindows) {
    input.setRawMode(false);
}This leaves stdin stuck in raw mode on Windows. In raw mode, Ctrl+C sends raw keypress data instead of generating SIGINT signals, so signal handlers never fire.
To Reproduce
Link to minimal reproduction:
https://stackblitz.com/edit/node-3wkqdznz?file=index.js,package.json
Steps to reproduce:
- Run the code above on Windows
 - Wait for spinner to stop
 - Press Ctrl+C
 - Bug: Process hangs - SIGINT handler never fires because stdin is in raw mode
 
Expected behavior
Pressing Ctrl+C should:
- Generate a SIGINT signal
 - Trigger the signal handler
 - Print "✓ SIGINT received!"
 - Exit the process
 
This works correctly on macOS/Linux but fails on Windows due to the !isWindows condition.
Additional Information
Workaround: Manually restore stdin after stopping the spinner:
spinner.stop("Done");
if (process.stdin.isTTY) {
    process.stdin.setRawMode(false);
}If there's a Windows-specific reason to keep raw mode during spinner execution, I'm unsure of the reason. This is causing my issues on Windows.
Metadata
Metadata
Assignees
Labels
Type
Projects
Status