mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-06-28 03:00:23 -07:00
Catch socket errors so if you control-c a playbook it does not traceback
This commit is contained in:
parent
33bc2610fa
commit
40ff3eb106
1 changed files with 6 additions and 2 deletions
|
@ -28,6 +28,7 @@ import base64
|
||||||
import getpass
|
import getpass
|
||||||
import codecs
|
import codecs
|
||||||
import collections
|
import collections
|
||||||
|
import socket
|
||||||
import re
|
import re
|
||||||
|
|
||||||
import ansible.constants as C
|
import ansible.constants as C
|
||||||
|
@ -741,8 +742,11 @@ class Runner(object):
|
||||||
worker.join()
|
worker.join()
|
||||||
|
|
||||||
results = []
|
results = []
|
||||||
while not result_queue.empty():
|
try:
|
||||||
results.append(result_queue.get(block=False))
|
while not result_queue.empty():
|
||||||
|
results.append(result_queue.get(block=False))
|
||||||
|
except socket.error:
|
||||||
|
raise errors.AnsibleError("<interrupted>")
|
||||||
return results
|
return results
|
||||||
|
|
||||||
# *****************************************************
|
# *****************************************************
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue