From 99fa691e1be0a7573c493c28be3a04704815e648 Mon Sep 17 00:00:00 2001 From: Connor Olding Date: Sat, 9 Oct 2021 09:08:28 -0700 Subject: [PATCH] exit early if `dd` fails --- sh/glug | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sh/glug b/sh/glug index c811fbd..5d0ad40 100644 --- a/sh/glug +++ b/sh/glug @@ -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 }