Commit 617fbec
committed
Abort installation on SIGINT (Ctrl+C)
Without a trap, pressing Ctrl+C during a sudo password prompt does not
terminate the script. sudo catches SIGINT internally to restore terminal
state and exits with a non-zero code, but bash never sees a signal-killed
child and continues execution.
Registering a trap on INT ensures the script always exits with code 130
(the conventional code for SIGINT-terminated processes) regardless of
how the signal is handled by child processes.1 parent 1ab5e65 commit 617fbec
1 file changed
Lines changed: 2 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
| 28 | + | |
| 29 | + | |
28 | 30 | | |
29 | 31 | | |
30 | 32 | | |
| |||
0 commit comments