mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Only display Ctrl-c message on SIGINT
This commit is contained in:
parent
9025be48c5
commit
0e7c600e02
1 changed files with 16 additions and 13 deletions
|
@ -47,19 +47,22 @@ def _handle_signals(client, signum, sigframe):
|
|||
except (AttributeError, KeyError):
|
||||
hardcrash = False
|
||||
|
||||
exit_msg = '\nExiting gracefully on Ctrl-c'
|
||||
try:
|
||||
jid = client.local_client.pub_data['jid']
|
||||
exit_msg += (
|
||||
'\n'
|
||||
'This job\'s jid is: {0}\n'
|
||||
'The minions may not have all finished running and any remaining '
|
||||
'minions will return upon completion. To look up the return data '
|
||||
'for this job later, run the following command:\n\n'
|
||||
'salt-run jobs.lookup_jid {0}'.format(jid)
|
||||
)
|
||||
except (AttributeError, KeyError):
|
||||
pass
|
||||
if signum == signal.SIGINT:
|
||||
exit_msg = '\nExiting gracefully on Ctrl-c'
|
||||
try:
|
||||
jid = client.local_client.pub_data['jid']
|
||||
exit_msg += (
|
||||
'\n'
|
||||
'This job\'s jid is: {0}\n'
|
||||
'The minions may not have all finished running and any remaining '
|
||||
'minions will return upon completion. To look up the return data '
|
||||
'for this job later, run the following command:\n\n'
|
||||
'salt-run jobs.lookup_jid {0}'.format(jid)
|
||||
)
|
||||
except (AttributeError, KeyError):
|
||||
pass
|
||||
else:
|
||||
exit_msg = None
|
||||
|
||||
_handle_interrupt(
|
||||
SystemExit(exit_msg),
|
||||
|
|
Loading…
Add table
Reference in a new issue