Skip to content

Instantly share code, notes, and snippets.

@netj
Created December 1, 2021 11:48
Show Gist options
  • Save netj/02e4d43ba737df4d8ff9532de3ebd6a4 to your computer and use it in GitHub Desktop.
Save netj/02e4d43ba737df4d8ff9532de3ebd6a4 to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
# yeshup -- wraps given command with a parent process that sends SIGTERM upon receiving SIGHUP, the opposite of nohup
# See also: https://github.com/RhysU/yeshup
set -eu
pid=$$
trap 'kill -TERM $pid' HUP
"$@" & pid=$!
wait
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment