From: Bo Cai Date: Wed, 13 Jan 2016 09:20:33 +0000 (+0800) Subject: ceph.in:avoid a broken pipe error when use ceph command X-Git-Tag: v10.0.3~53^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=f6eb3e5569e59e728b1c045a405367ceb7e0a93a;p=ceph.git ceph.in:avoid a broken pipe error when use ceph command Fixes: #14354 Signed-off-by: Bo Cai --- diff --git a/src/ceph.in b/src/ceph.in index 1142b20d2bce..d766a7e15ddc 100755 --- a/src/ceph.in +++ b/src/ceph.in @@ -917,10 +917,14 @@ def main(): if suffix != '': outbuf = outbuf.rstrip() if outbuf != '': - # Write directly to binary stdout - raw_stdout.write(prefix) - raw_stdout.write(outbuf) - raw_stdout.write(suffix) + try: + # Write directly to binary stdout + raw_stdout.write(prefix) + raw_stdout.write(outbuf) + raw_stdout.write(suffix) + except IOError as e: + if e.errno != errno.EPIPE: + raise e sys.stdout.flush()