1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

Ensure sys.stdout has an istty method

This commit is contained in:
James Tanner 2014-01-10 17:42:43 -05:00
parent d7c8cf6ca7
commit 09e0d052ca

View file

@ -745,9 +745,10 @@ class Runner(object):
data = result.result data = result.result
# https://github.com/ansible/ansible/issues/4958 # https://github.com/ansible/ansible/issues/4958
if "stdout" in data and sys.stdout.isatty(): if hasattr(sys.stdout, "isatty"):
if not string_functions.isprintable(data['stdout']): if "stdout" in data and sys.stdout.isatty():
data['stdout'] = '' if not string_functions.isprintable(data['stdout']):
data['stdout'] = ''
if 'item' in inject: if 'item' in inject:
result.result['item'] = inject['item'] result.result['item'] = inject['item']