mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Refine new keyboard interrupt handling. Output still a bit gross.
This commit is contained in:
parent
47b1315ac7
commit
92ce8a0517
1 changed files with 9 additions and 2 deletions
|
@ -566,7 +566,7 @@ class Runner(object):
|
||||||
try:
|
try:
|
||||||
return p.map(_executor_hook, hosts)
|
return p.map(_executor_hook, hosts)
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
pool.terminate()
|
p.terminate()
|
||||||
raise errors.AnsibleError("Interrupted")
|
raise errors.AnsibleError("Interrupted")
|
||||||
|
|
||||||
# *****************************************************
|
# *****************************************************
|
||||||
|
@ -627,7 +627,14 @@ class Runner(object):
|
||||||
for h in hosts ]
|
for h in hosts ]
|
||||||
del self.host_set
|
del self.host_set
|
||||||
elif self.forks > 1:
|
elif self.forks > 1:
|
||||||
results = self._parallel_exec(hosts)
|
try:
|
||||||
|
results = self._parallel_exec(hosts)
|
||||||
|
except IOError, ie:
|
||||||
|
print ie.errno
|
||||||
|
if ie.errno == 32:
|
||||||
|
# broken pipe from Ctrl+C
|
||||||
|
raise errors.AnsibleError("interupted")
|
||||||
|
raise
|
||||||
else:
|
else:
|
||||||
results = [ self._executor(h) for h in hosts ]
|
results = [ self._executor(h) for h in hosts ]
|
||||||
return self._partition_results(results)
|
return self._partition_results(results)
|
||||||
|
|
Loading…
Reference in a new issue