chiark / gitweb /
test suite: stunt gnupg runs gpg again if it exits status 2
[dgit.git] / tests / tstunt / gpg
index d71aa63f359d601081ef215188ef69d5cc09f120..790c46c86ed9a3d6b6cf2cfa872f8eb6f446c668 100755 (executable)
@@ -1,6 +1,20 @@
 #!/bin/sh
 set -e
-exec                                                   \
+
+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 $*"
+
+done
+
+exit 127