Catch EPIPE exception and return

Otherwise you get a traceback if you pipe `jenkins-jobs` to the UNIX
`head` command.

Change-Id: If83fd5b9f4aacd031e9ab0c35d61cc6d57542be9
This commit is contained in:
Marc Abramowitz 2014-04-26 09:57:31 -07:00
parent c68249a7f1
commit 2ef117d5fd

@ -15,6 +15,7 @@
# Manage jobs in Jenkins server
import errno
import os
import sys
import hashlib
@ -591,7 +592,15 @@ class Builder(object):
if hasattr(output, 'write'):
# `output` is a file-like object
logger.debug("Writing XML to '{0}'".format(output))
output.write(job.output())
try:
output.write(job.output())
except IOError as exc:
if exc.errno == errno.EPIPE:
# EPIPE could happen if piping output to something
# that doesn't read the whole input (e.g.: the UNIX
# `head` command)
return
raise
continue
output_dir = output