mirror of
https://github.com/romanz/amodem.git
synced 2026-02-07 18:08:03 +08:00
gpg: handle KILLAGENT command
so `gpg-connect-agent KILLAGENT` should stop the running agent
This commit is contained in:
@@ -112,6 +112,9 @@ def main_agent():
|
||||
with contextlib.closing(conn):
|
||||
try:
|
||||
agent.handle_connection(conn)
|
||||
except StopIteration:
|
||||
log.info('stopping gpg-agent')
|
||||
return
|
||||
except Exception as e: # pylint: disable=broad-except
|
||||
log.exception('gpg-agent failed: %s', e)
|
||||
|
||||
|
||||
@@ -142,6 +142,9 @@ def handle_connection(conn):
|
||||
keyring.sendline(conn, fmt.format(keygrip).encode('ascii'))
|
||||
elif command == b'BYE':
|
||||
return
|
||||
elif command == b'KILLAGENT':
|
||||
keyring.sendline(conn, b'OK')
|
||||
raise StopIteration
|
||||
else:
|
||||
log.error('unknown request: %r', line)
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user