瀏覽代碼

Add a trap for Ctrl+C

Tianon Gravi 10 年之前
父節點
當前提交
badea764f2
共有 1 個文件被更改,包括 3 次插入0 次删除
  1. 3 0
      bashbrew/bashbrew.sh

+ 3 - 0
bashbrew/bashbrew.sh

@@ -1,6 +1,9 @@
 #!/bin/bash
 set -e
 
+# make sure we can GTFO
+trap 'echo >&2 Ctrl+C captured, exiting; exit 1' SIGINT
+
 # so we can have fancy stuff like !(pattern)
 shopt -s extglob