[pass] [PATCH] clip: Show an error message if xclip returns a non-zero exit code

Jason A. Donenfeld Jason at zx2c4.com
Mon Jan 19 11:45:39 CET 2015


On Fri, Jan 16, 2015 at 8:38 PM, Wieland Hoffmann <themineo at gmail.com>
wrote:
>
> diff --git a/src/password-store.sh b/src/password-store.sh
> index d4e9515..3f7417d 100755
> --- a/src/password-store.sh
> +++ b/src/password-store.sh
> @@ -131,11 +131,11 @@ clip() {
>         # This base64 business is because bash cannot store binary data in
> a shell
>         # variable. Specifically, it cannot store nulls nor (non-trivally)
> store
>         # trailing new lines.
> -
>         local sleep_argv0="password store sleep on display $DISPLAY"
>         pkill -f "^$sleep_argv0" 2>/dev/null && sleep 0.5
>         local before="$(xclip -o -selection "$X_SELECTION" | base64)"
>

As you suggested, 2>/dev/null on the invocation above would be useful.


>         echo -n "$1" | xclip -selection "$X_SELECTION"
> +       [ $? -ne 0 ] && die "Error: Could not copy data to the clipboard."
>

Pass uses [[ and ]] when it can.


>         (
>                 ( exec -a "$sleep_argv0" sleep "$CLIP_TIME" )
>                 local now="$(xclip -o -selection "$X_SELECTION" | base64)"
> --
> 2.2.2
>
> _______________________________________________
> Password-Store mailing list
> Password-Store at lists.zx2c4.com
> http://lists.zx2c4.com/mailman/listinfo/password-store
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.zx2c4.com/pipermail/password-store/attachments/20150119/a029f5c3/attachment.html>


More information about the Password-Store mailing list