##// END OF EJS Templates
Add flushing to stdout/stderr in system calls.
Brian Granger -
Show More
@@ -1,20 +1,22 b''
1 1 import sys
2 2 from subprocess import Popen, PIPE
3 3 from IPython.core.interactiveshell import InteractiveShell, InteractiveShellABC
4 4
5 5
6 6 class ZMQInteractiveShell(InteractiveShell):
7 7 """A subclass of InteractiveShell for ZMQ."""
8 8
9 9 def system(self, cmd):
10 10 cmd = self.var_expand(cmd, depth=2)
11 sys.stdout.flush()
12 sys.stderr.flush()
11 13 p = Popen(cmd, shell=True, stdout=PIPE, stderr=PIPE)
12 14 for line in p.stdout.read().split('\n'):
13 15 if len(line) > 0:
14 16 print line
15 17 for line in p.stderr.read().split('\n'):
16 18 if len(line) > 0:
17 19 print line
18 20 return p.wait()
19 21
20 22 InteractiveShellABC.register(ZMQInteractiveShell)
General Comments 0
You need to be logged in to leave comments. Login now