mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02: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 codecs
|
||||
import collections
|
||||
import socket
|
||||
import re
|
||||
|
||||
import ansible.constants as C
|
||||
|
@ -741,8 +742,11 @@ class Runner(object):
|
|||
worker.join()
|
||||
|
||||
results = []
|
||||
while not result_queue.empty():
|
||||
results.append(result_queue.get(block=False))
|
||||
try:
|
||||
while not result_queue.empty():
|
||||
results.append(result_queue.get(block=False))
|
||||
except socket.error:
|
||||
raise errors.AnsibleError("<interrupted>")
|
||||
return results
|
||||
|
||||
# *****************************************************
|
||||
|
|
Loading…
Reference in a new issue