Skip to content

Commit 43c7058

Browse files
committed
Allow user to Ctrl+c to exit the function
1 parent aed77af commit 43c7058

2 files changed

Lines changed: 10 additions & 0 deletions

File tree

confirm/confirm-user-action.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,11 @@
3535

3636
confirm_user_action()
3737
{
38+
trap '
39+
trap - INT # restore default INT handler
40+
kill -s INT "$$"
41+
' INT
42+
3843
local LOCAL_USER_RESPONSE LOCAL_USER_QUESTION LOCAL_KILL_SCRIPT LOCAL_INVERT_DEFAULT
3944

4045
LOCAL_USER_QUESTION="${1:-Are you sure you want to continue?}"

select/select-multiple-data.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,11 @@
3131

3232
select_multiple_data()
3333
{
34+
trap '
35+
trap - INT # restore default INT handler
36+
kill -s INT "$$"
37+
' INT
38+
3439
GLOBAL_MULTIDATA_SELECT_DATA=(${1})
3540

3641
[[ $GLOBAL_MULTIDATA_SELECT_DATA == "" || ${#GLOBAL_MULTIDATA_SELECT_DATA[@]} -eq 0 ]] && echoerror "You must inform the required argument(s) to the function: '${FUNCNAME[0]}'"

0 commit comments

Comments
 (0)