From 6be4d0473872fb49a571afa0d3be17f0e0dfea03 Mon Sep 17 00:00:00 2001 From: Isen <3904043+isen-ng@users.noreply.github.com> Date: Fri, 5 Jul 2019 13:55:14 +0800 Subject: [PATCH] Use the -9 kill signal with pkill When `helm tiller start-ci` is run in a golang/exec command, running `helm tiller stop` in the parent shell or a different golang/exec command does not stop the `./bin/tiller` process. I ran into this when trying to start `helm tiller start-ci` in a terragrunt before hook and terragrunt uses golang/exec to run their commands. In golang/exec (https://golang.org/pkg/os/exec/) it says this: "Unlike the "system" library call from C and other languages, the os/exec package intentionally does not invoke the system shell ..." Which is the likely cause of the issue. To overcome this, all we need to do is to change `pkill -f ./bin/tiller` to `pkill -9 -f ./bin/tiller`. Sending `-9` means sending a stronger kill signal to the process, to ensure even non-responding process are killed. --- scripts/tiller.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/tiller.sh b/scripts/tiller.sh index 486de9c..2b38cdd 100755 --- a/scripts/tiller.sh +++ b/scripts/tiller.sh @@ -175,7 +175,7 @@ stop_tiller() { if [[ "${HELM_TILLER_SILENT}" == "false" ]]; then echo "Stopping Tiller..." fi - pkill -f ./bin/tiller + pkill -9 -f ./bin/tiller } COMMAND=$1