1
0
Fork 0
mirror of https://github.com/notwa/rc synced 2024-11-05 06:39:02 -08:00

exit early if dd fails

This commit is contained in:
Connor Olding 2021-10-09 09:08:28 -07:00
parent c0586e4442
commit 99fa691e1b

View file

@ -96,7 +96,7 @@ glug() ( # note the subshell syntax. this allows us to abuse globals like crazy.
old="$(stty -g)"
trap 'stty "$old"' INT EXIT
stty -icanon -echo
dd ibs=1 count=1 2>/dev/null
dd ibs=1 count=1 2>/dev/null || exit
echo _ # append an underscore so that newlines are preserved in captures
} </dev/tty # ensure this interacts with a terminal instead of a pipe