Catch pipe errors

This commit is contained in:
Colton Myers 2013-03-28 18:03:30 -06:00
parent b4dab551d0
commit bc4b415da6

View File

@ -3,6 +3,8 @@ Used to manage the outputter system. This package is the modular system used
for managing outputters.
'''
import errno
# Import salt libs
import salt.loader
@ -23,7 +25,12 @@ def display_output(data, out, opts=None):
print(get_printout(out, opts)(data).rstrip())
except Exception:
opts.pop('output', None)
print(get_printout('nested', opts)(data).rstrip())
try:
print(get_printout('nested', opts)(data).rstrip())
except IOError as e:
# Only raise if it's NOT a broken pipe
if e.errno != errno.EPIPE:
raise e
def get_printout(out, opts=None, **kwargs):