fix broken pipe crash in run_pip()
--HG-- branch : pmacs2
This commit is contained in:
parent
5cd69146a6
commit
02da5d5d3c
|
@ -734,8 +734,13 @@ class Application(object):
|
||||||
def run_pipe(self, args, b, name='*Output*', switch=True, modename=None):
|
def run_pipe(self, args, b, name='*Output*', switch=True, modename=None):
|
||||||
pipe = Popen(args=args, stdin=PIPE, stdout=PIPE, stderr=STDOUT)
|
pipe = Popen(args=args, stdin=PIPE, stdout=PIPE, stderr=STDOUT)
|
||||||
data = b.make_string().encode('utf-8')
|
data = b.make_string().encode('utf-8')
|
||||||
|
try:
|
||||||
pipe.stdin.write(data)
|
pipe.stdin.write(data)
|
||||||
pipe.stdin.close()
|
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()
|
output = pipe.stdout.read()
|
||||||
status = pipe.wait()
|
status = pipe.wait()
|
||||||
if callable(switch):
|
if callable(switch):
|
||||||
|
|
Loading…
Reference in New Issue