From 0eb4c18fe09c3f01bee3ec16206738a3a53f78ae Mon Sep 17 00:00:00 2001 From: Tiago Costa Date: Tue, 10 Dec 2019 22:05:19 +0000 Subject: [PATCH] feat(NA): add trap for SIGINT in the git precommit hook (#52662) --- src/dev/register_git_hook/register_git_hook.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/dev/register_git_hook/register_git_hook.js b/src/dev/register_git_hook/register_git_hook.js index a61922078e687..31136cab0adae 100644 --- a/src/dev/register_git_hook/register_git_hook.js +++ b/src/dev/register_git_hook/register_git_hook.js @@ -58,6 +58,15 @@ function getKbnPrecommitGitHookScript(rootPath, nodeHome, platform) { set -euo pipefail + # Make it possible to terminate pre commit hook + # using ctrl-c so nothing else would happen or be + # sent to the output. + # + # The correct exit code on that situation + # according the linux documentation project is 130 + # https://www.tldp.org/LDP/abs/html/exitcodes.html + trap "exit 130" SIGINT + has_node() { command -v node >/dev/null 2>&1 }