[PATCH] clip: sleep may require argv[0] to be sleep on darwin and cygwin too

Andreas Källberg anka.213 at gmail.com
Sat Apr 18 18:50:07 CEST 2020


From: Andreas Källberg <andreas at svalna.se>

This is the patch b08781e2a6e183986eb1c24f51cdeff879b7a6af applied to
the darwin and cygwin platforms.

I ran into this bug after installing gnu corutils on my mac. It silently
failed to copy without any error message.
---
 src/platform/cygwin.sh | 2 +-
 src/platform/darwin.sh | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/platform/cygwin.sh b/src/platform/cygwin.sh
index 5a8d5ea..5859d24 100644
--- a/src/platform/cygwin.sh
+++ b/src/platform/cygwin.sh
@@ -7,7 +7,7 @@ clip() {
 	local before="$($BASE64 < /dev/clipboard)"
 	echo -n "$1" > /dev/clipboard
 	(
-		( exec -a "$sleep_argv0" sleep "$CLIP_TIME" )
+		( exec -a "$sleep_argv0" bash <<<"trap 'kill %1' TERM; sleep '$CLIP_TIME' & wait" )
 		local now="$($BASE64 < /dev/clipboard)"
 		[[ $now != $(echo -n "$1" | $BASE64) ]] && before="$now"
 		echo "$before" | $BASE64 -d > /dev/clipboard
diff --git a/src/platform/darwin.sh b/src/platform/darwin.sh
index 342ecce..6b1412a 100644
--- a/src/platform/darwin.sh
+++ b/src/platform/darwin.sh
@@ -7,7 +7,7 @@ clip() {
 	local before="$(pbpaste | $BASE64)"
 	echo -n "$1" | pbcopy
 	(
-		( exec -a "$sleep_argv0" sleep "$CLIP_TIME" )
+		( exec -a "$sleep_argv0" bash <<<"trap 'kill %1' TERM; sleep '$CLIP_TIME' & wait" )
 		local now="$(pbpaste | $BASE64)"
 		[[ $now != $(echo -n "$1" | $BASE64) ]] && before="$now"
 		echo "$before" | $BASE64 -d | pbcopy
-- 
2.23.0



More information about the Password-Store mailing list