]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
ceph.in:avoid a broken pipe error when use ceph command 7212/head
authorBo Cai <cai.bo@h3c.com>
Wed, 13 Jan 2016 09:20:33 +0000 (17:20 +0800)
committerBo Cai <cai.bo@h3c.com>
Thu, 14 Jan 2016 12:10:02 +0000 (20:10 +0800)
Fixes: #14354
Signed-off-by: Bo Cai <cai.bo@h3c.com>
src/ceph.in

index 1142b20d2bce944d87fec57e84ae0c61122e6caf..d766a7e15ddc5afdda3ac2ee4fa221180410ed5e 100755 (executable)
@@ -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()