Created
November 3, 2023 18:48
-
-
Save Jan-Zeiseweis/d7f85b99f459d370dd0c42709602e2dc to your computer and use it in GitHub Desktop.
kill_wrapper
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# run some program, and KILL it with deadly force upon ^C :) --sq5bpf | |
# this is a hack to make | |
CPID=0 | |
intr() { | |
echo "killing $CPID" | |
kill -9 $CPID | |
} | |
trap intr 1 | |
trap intr 2 | |
trap intr 3 | |
trap intr 15 | |
$* & | |
CPID=$! | |
echo "child PID = $CPID" | |
wait $CPID | |
echo ending |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment