Skip to content

Commit 9462179

Browse files
author
Néstor Salceda
committed
Terminate capture pod when script was interrupted with Ctrl+c
1 parent 4b52142 commit 9462179

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

kubectl-capture

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,4 +167,15 @@ function wait_until_finished() {
167167
rm .finished
168168
}
169169

170+
trap delete_capture_pod INT
171+
172+
function delete_capture_pod() {
173+
if [[ -n "${capture_pod}" ]]; then
174+
echo ""
175+
echo "Please wait until capture pod is deleted"
176+
kubectl delete pod ${capture_pod} > /dev/null 2>&1
177+
fi
178+
exit 0
179+
}
180+
170181
main "$@"

0 commit comments

Comments
 (0)