summaryrefslogtreecommitdiff
path: root/tests/tstunt/gpg-locked
diff options
context:
space:
mode:
Diffstat (limited to 'tests/tstunt/gpg-locked')
-rwxr-xr-xtests/tstunt/gpg-locked32
1 files changed, 32 insertions, 0 deletions
diff --git a/tests/tstunt/gpg-locked b/tests/tstunt/gpg-locked
new file mode 100755
index 0000000..892b9c8
--- /dev/null
+++ b/tests/tstunt/gpg-locked
@@ -0,0 +1,32 @@
+#!/bin/sh
+set -e
+
+for attempt in '' ' ' exec; do
+
+set +e
+$attempt \
+$DGIT_TEST_REAL_GPG \
+ --agent-program=$DGIT_STUNT_AGENT \
+ "$@"
+rc=$?
+set -e
+
+if [ $rc != 2 ]; then exit $rc; fi
+
+echo >&2 "WARNING - GNUPG FAILED $rc - STUNT GNUPG $attempt $*"
+
+sh -ec '
+ if [ "x$DGIT_GNUPG_STUNT_ERRLOG" != x ]; then
+ exec >"$DGIT_GNUPG_STUNT_ERRLOG"
+ else
+ exec 2>/dev/null
+ fi
+ exec >/dev/tty
+ printf "%s\n" "$*"
+' x "GNUPG WRAPPER - TROUBLE - $HOME $GNUPGHOME - FAILED $rc $attempt $*"
+
+sleep 10
+
+done
+
+exit 127