Skip to content

Commit 3bf2341

Browse files
committed
fix: Do not attach INT trap if being sourced
1 parent aeeee6e commit 3bf2341

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

lib/util.sh

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22

33

44
# -------------------------- run ------------------------- #
5-
6-
trap sigint INT
7-
sigint() {
8-
set +x
9-
die 'Received SIGINT'
10-
}
11-
5+
if [[ "${BASH_SOURCE[0]}" = "${0}" ]]; then
6+
trap sigint INT
7+
sigint() {
8+
set +x
9+
die 'Received SIGINT'
10+
}
11+
fi
1212

1313
# -------------------- util functions -------------------- #
1414

0 commit comments

Comments
 (0)