Skip to content

Instantly share code, notes, and snippets.

@nicksieger
Created December 6, 2021 15:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nicksieger/325fe4ce2e7a8925a3c549ddb37acc21 to your computer and use it in GitHub Desktop.
Save nicksieger/325fe4ce2e7a8925a3c549ddb37acc21 to your computer and use it in GitHub Desktop.
Runs `tilt up`, then `tilt down` upon interrupt
#!/bin/bash
#
# Wrap tilt so that a Ctrl-C will call `tilt down` when done.
tilt=
do_auto_down() {
echo "Interrupt; killing $tilt"
kill -INT $tilt
tilt down
exit 0
}
trap do_auto_down SIGINT
# Dup stdin and delegate to tilt
exec 3<&0
tilt up "$@" <&3 &
tilt=$!
wait $tilt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment