Skip to content

Commit ab447e5

Browse files
committed
feat(NA): add trap for SIGINT in the git precommit hook (#52662)
1 parent b86ba34 commit ab447e5

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

src/dev/register_git_hook/register_git_hook.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,15 @@ function getKbnPrecommitGitHookScript(rootPath, nodeHome, platform) {
5858
5959
set -euo pipefail
6060
61+
# Make it possible to terminate pre commit hook
62+
# using ctrl-c so nothing else would happen or be
63+
# sent to the output.
64+
#
65+
# The correct exit code on that situation
66+
# according the linux documentation project is 130
67+
# https://www.tldp.org/LDP/abs/html/exitcodes.html
68+
trap "exit 130" SIGINT
69+
6170
has_node() {
6271
command -v node >/dev/null 2>&1
6372
}

0 commit comments

Comments
 (0)