From 8681d2000b756955f6f1a25601e0c3128691cb5c Mon Sep 17 00:00:00 2001 From: "Jason A. Donenfeld" Date: Sun, 30 Sep 2012 18:34:32 +0200 Subject: Check error code of gpg before copying to clipboard. --- src/password-store.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/password-store.sh b/src/password-store.sh index e4e622e..4a04fbe 100755 --- a/src/password-store.sh +++ b/src/password-store.sh @@ -223,7 +223,9 @@ case "$command" in if [[ $clip -eq 0 ]]; then exec gpg2 -d $GPG_OPTS "$passfile" else - clip "$(gpg2 -d $GPG_OPTS "$passfile" | head -n 1)" "$path" + pass="$(gpg2 -d $GPG_OPTS "$passfile" | head -n 1)" + [[ -n $pass ]] || exit 1 + clip "$pass" "$path" fi fi ;; -- cgit v1.2.3