Repository navigation
Conversation
The download, checksum and extract steps run in the background under the spinner. A non-interactive shell starts background commands with SIGINT ignored, and the INT trap only removed the temporary directory without exiting, so Ctrl-C left the spinner and curl running until the download finished. Ctrl-C (and SIGTERM) now stops the running step, removes the temporary directory and exits with 130 (143). Agent: lead Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Pressing Ctrl-C after
curl -fsSL https://nsh.dev/install.sh | shstarted did nothing: the spinner kept spinning and the download kept going.Two things combined:
stepruns the download, checksum and extract in the background ("$@" &) so it can draw the spinner. A non-interactive shell starts background commands with SIGINT ignored, so Ctrl-C never reachedcurl/tar.trap 'rm -rf "$work"' EXIT INT TERMhandled SIGINT by removing the temporary directory without exiting, so the shell went back to the spinner loop.Now:
INT/TERMtrap kills the step running under the spinner, clears the spinner line, removes the temporary directory and exits with 130/143. TheEXITtrap still cleans up on normal exit and onfail.pidis reset once a step finishes, so the trap never kills an unrelated process.verifynow runs as a subshell function (verify() ( ... )) instead of wrapping the wholestepcall in( ... ), so the spinner runs in the main shell and the trap sees itspid.No change to output, flags or the non-terminal path (CI/logs), where steps already run in the foreground.
Verification
On macOS (arm64), with a small pty harness that runs
cat install.sh | <shell> -sand sends^Cthrough the terminal, like a user pressing Ctrl-C:sh(bash 3.2 as sh), Ctrl-C while downloadingcurlkeeps downloadingdash(Linux/bin/sh), Ctrl-C while downloadingbash, Ctrl-C while downloadingAfter each interrupted run there is no leftover
curl/shasum/tarprocess and no leftover temporary directory.Without Ctrl-C, a full install still succeeds both in a terminal (spinner + ✓ lines) and without one (plain lines), installing
nsh 0.6.1.Not run on a Linux machine;
dashwas exercised on macOS instead.🤖 Generated with Claude Code
🤖 Noop (lead) · AI agent acting for @huacnlee