Description
install.sh has zero trap statements in the entire 550+ line script. The spin() function (line 185) backgrounds a command and polls it with a spinner animation, but if the user presses Ctrl+C during execution:
- The backgrounded process (npm install, docker build, git clone, etc.) continues running
- The temp file created by
mktemp on line 188 is never cleaned up
- Any partially-written state (node_modules, Docker layers, cloned repos) is left behind
What happens: Ctrl+C during installation leaves orphaned processes running and temp files in /tmp.
What should happen: The script should register a cleanup trap that kills backgrounded processes and removes temp files on SIGINT/SIGTERM.
Reproduction Steps
- Run the installer:
curl -fsSL https://www.nvidia.com/nemoclaw.sh | bash
- During any spinner step (e.g., "Preparing OpenClaw package", "Installing dependencies"), press Ctrl+C
- Check for orphaned processes:
ps aux | grep -E "npm install|docker build|git clone"
- Check for leaked temp files:
Environment
- Code review of
main branch (commit HEAD as of 2026-03-26)
- Affected file:
install.sh — entire file
Logs
No trap in the entire script:
$ grep -n 'trap ' install.sh
# (no output)
spin() function — backgrounds command, no cleanup (lines 185–212):
spin() {
# ...
local log
log=$(mktemp) # temp file created
"$@" >"$log" 2>&1 & # command backgrounded
local pid=$! i=0
while kill -0 "$pid" 2>/dev/null; do
printf "\r %s %s" "${frames[$((i++ % 10))]}" "$msg"
sleep 0.08
done
# ... status check ...
rm -f "$log" # only cleaned up on normal exit
return $status
}
Expected pattern:
_cleanup_pids=()
_cleanup_files=()
cleanup() {
for pid in "${_cleanup_pids[@]}"; do
kill "$pid" 2>/dev/null
done
for f in "${_cleanup_files[@]}"; do
rm -f "$f"
done
}
trap cleanup EXIT SIGINT SIGTERM
spin() {
local log
log=$(mktemp)
_cleanup_files+=("$log")
"$@" >"$log" 2>&1 &
local pid=$!
_cleanup_pids+=("$pid")
# ...
}
Checklist
Description
install.shhas zerotrapstatements in the entire 550+ line script. Thespin()function (line 185) backgrounds a command and polls it with a spinner animation, but if the user presses Ctrl+C during execution:mktempon line 188 is never cleaned upWhat happens: Ctrl+C during installation leaves orphaned processes running and temp files in
/tmp.What should happen: The script should register a cleanup trap that kills backgrounded processes and removes temp files on SIGINT/SIGTERM.
Reproduction Steps
curl -fsSL https://www.nvidia.com/nemoclaw.sh | bashls /tmp/tmp.*Environment
mainbranch (commit HEAD as of 2026-03-26)install.sh— entire fileLogs
No trap in the entire script:
spin() function — backgrounds command, no cleanup (lines 185–212):
Expected pattern:
Checklist