fix(nanoclaw bootstrap): restore terminal state, don't launch TUI under a pipe - #26
Open
nir-singher-band wants to merge 1 commit into
Open
fix(nanoclaw bootstrap): restore terminal state, don't launch TUI under a pipe#26nir-singher-band wants to merge 1 commit into
nir-singher-band wants to merge 1 commit into
Conversation
…er a pipe Two terminal-hygiene fixes for running under `curl | bash`: - register-agent.sh prompts for the API key with `read -s` (echo off) on /dev/tty. If the script dies mid-prompt the terminal is left in raw / no-echo state. Save `stty -g` up front and restore it on EXIT (falling back to `stty sane`). The registration block's tempfile-cleanup trap previously did `trap - EXIT`, which would have wiped this restore trap — fold the creds cleanup into the trap and re-arm the restore instead of clearing it. - The handoff did `claude /add-band < /dev/tty` unconditionally, spawning a nested interactive Claude TUI reading /dev/tty while the parent shell is the `curl | bash` pipe. When stdin isn't a terminal, restore the tty and print instructions to cd in and run `claude /add-band` from a real prompt instead. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.
What
Two terminal-hygiene fixes in
nanoclaw/bootstrap.shfor thecurl | bashinstall path.Why
1. Terminal left in raw / no-echo state
register-agent.shprompts for the Band API key withread -s(echo off) on/dev/tty. If the script dies mid-prompt, the terminal stays in that state after the script exits.stty -gup front (when/dev/ttyis usable) and restore it onEXIT, falling back tostty sane.trap - EXITafter removing the creds file — which would have wiped the restore trap set at the top. Fixed by folding creds cleanup into the trap and re-arming the restore (trap _band_restore_tty EXIT) instead of clearing it.2. Nested TUI launched from inside the pipe
The handoff did
claude /add-band < /dev/ttyunconditionally, spawning an interactive Claude TUI that reads/dev/ttywhile the parent shell is thecurl | bashpipe. When stdin isn't a terminal, restore the tty and print instructions tocdin and runclaude /add-bandfrom a real prompt instead. When stdin is a terminal, behavior is unchanged (claude /add-band).Test
bash -nclean,shellcheck -S warningcleantests/test_catalog_drift.py: 10 passed, 1 skipped (incl.test_bootstrap_syntax)Notes
Stacks cleanly on top of #25 (the
nanoclaw_setup_donehint) — that hint runs in its own trap-free subshell and is untouched by the new EXIT trap. Parallels the existingfix/hermes-bootstrap-ttywork.🤖 Generated with Claude Code