From a43eafe1b054f38878116e018e3aa5b4497d4edb Mon Sep 17 00:00:00 2001 From: Travis Glenn Hansen Date: Sat, 11 Dec 2021 16:01:49 -0700 Subject: [PATCH] process cleanup attempt Signed-off-by: Travis Glenn Hansen --- ci/bin/launch-server.sh | 2 +- ci/bin/run.sh | 9 ++++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/ci/bin/launch-server.sh b/ci/bin/launch-server.sh index 52753c3..93274a5 100755 --- a/ci/bin/launch-server.sh +++ b/ci/bin/launch-server.sh @@ -23,4 +23,4 @@ if [[ "x${CSI_MODE}" != "x" ]];then fi # > "${LOG_PATH}" 2>&1 -./bin/democratic-csi --log-level debug --driver-config-file "${CONFIG_FILE}" --csi-version "${CSI_VERSION}" --csi-name "driver-test" --server-socket "${CSI_ENDPOINT}" ${EXTRA_ARGS} +exec ./bin/democratic-csi --log-level debug --driver-config-file "${CONFIG_FILE}" --csi-version "${CSI_VERSION}" --csi-name "driver-test" --server-socket "${CSI_ENDPOINT}" ${EXTRA_ARGS} diff --git a/ci/bin/run.sh b/ci/bin/run.sh index 5260dcd..fd1c7ac 100755 --- a/ci/bin/run.sh +++ b/ci/bin/run.sh @@ -3,7 +3,13 @@ set -e set -x -trap 'kill -- -$(ps -o pgid= $PID | grep -o '[0-9]*')' EXIT +_term() { + [[ -n "${SUDO_PID}" ]] && kill -- "${SUDO_PID}" +} + +trap _term EXIT + +#trap 'kill -- -$(ps -o pgid= $PID | grep -o '[0-9]*')' EXIT #trap 'kill -- -$PGID' EXIT #trap 'sudo kill -- -$PGID' EXIT #trap 'sudo kill $(jobs -p)' EXIT @@ -18,6 +24,7 @@ export CI_BUILD_KEY=$(uuidgen | cut -d "-" -f 1) # launch the server sudo -E ci/bin/launch-server.sh & +SUDO_PID=$! # wait for server to launch sleep 10