Skip to content

Instantly share code, notes, and snippets.

@Jan-Zeiseweis
Created November 3, 2023 18:48
Show Gist options
  • Save Jan-Zeiseweis/d7f85b99f459d370dd0c42709602e2dc to your computer and use it in GitHub Desktop.
Save Jan-Zeiseweis/d7f85b99f459d370dd0c42709602e2dc to your computer and use it in GitHub Desktop.
kill_wrapper
#!/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