#797334 gpg-connect-agent exits with status 0 when no agent running

#797334#5
Date:
2015-08-29 16:12:26 UTC
From:
To:
$ gpg-connect-agent --no-autostart -- NOP /bye
gpg-connect-agent: no gpg-agent running in this session
$ echo $?
0
$

The exit status should indicate an error if the connection fails, as it
did before GnuPG 2.1.  (My shell startup script runs gpg-agent for its
ssh support, when not already running, and this change breaks it.)

A workaround is to avoid --no-autostart, and pass a bad --agent-program:
$ gpg-connect-agent --agent-program /dev/null -- NOP /bye
gpg-connect-agent: no running gpg-agent - starting '/dev/null'
gpg-connect-agent: failed to start agent '/dev/null': Permission denied
gpg-connect-agent: can't connect to the agent: Permission denied
gpg-connect-agent: error sending standard options: No agent running
$ echo $?
1
$

- Michael