Created
December 6, 2021 15:18
-
-
Save nicksieger/325fe4ce2e7a8925a3c549ddb37acc21 to your computer and use it in GitHub Desktop.
Runs `tilt up`, then `tilt down` upon interrupt
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 | |
# | |
# 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