commit 2f64b456774ffd8b1c8d17e5deb86030599ec00d
parent 3a5485f36c63d732468156d8020b9fb2c3c5799b
Author: Dylan Araps <dylan.araps@gmail.com>
Date: Sat, 29 Feb 2020 20:13:47 +0200
kiss: Abort if not TTY and needed
Diffstat:
1 file changed, 5 insertions(+), 0 deletions(-)
diff --git a/kiss b/kiss
@@ -1216,6 +1216,11 @@ args() {
die "Arguments contain invalid characters: '!*[]'"
esac
+ # Abort early if output is not a TTY and the requirement is that it
+ # be so (password prompts, user input, etc). This is a safeguard.
+ [ "${action##[bciru]*}" ] || [ -t 1 ] ||
+ die "Output not a tty"
+
# Parse some arguments earlier to remove the need to duplicate code.
case $action in
c|checksum|s|search)