From 02da5d5d3c2b6e49cde01e63a55de67ee114622f Mon Sep 17 00:00:00 2001 From: Erik Osheim Date: Tue, 1 Jun 2010 14:36:07 -0400 Subject: [PATCH] fix broken pipe crash in run_pip() --HG-- branch : pmacs2 --- application.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/application.py b/application.py index 6fa2281..50f9f2b 100755 --- a/application.py +++ b/application.py @@ -734,8 +734,13 @@ class Application(object): def run_pipe(self, args, b, name='*Output*', switch=True, modename=None): pipe = Popen(args=args, stdin=PIPE, stdout=PIPE, stderr=STDOUT) data = b.make_string().encode('utf-8') - pipe.stdin.write(data) - pipe.stdin.close() + try: + pipe.stdin.write(data) + pipe.stdin.close() + except IOError: + # sometimes the program will stop reading from stdin before we're + # done. this is fine and we should ignore the IOError. + pass output = pipe.stdout.read() status = pipe.wait() if callable(switch):