##// END OF EJS Templates
Initial version of system command out/err forwarding.
Brian Granger -
Show More
@@ -0,0 +1,20 b''
1 import sys
2 from subprocess import Popen, PIPE
3 from IPython.core.interactiveshell import InteractiveShell, InteractiveShellABC
4
5
6 class ZMQInteractiveShell(InteractiveShell):
7 """A subclass of InteractiveShell for ZMQ."""
8
9 def system(self, cmd):
10 cmd = self.var_expand(cmd, depth=2)
11 p = Popen(cmd, shell=True, stdout=PIPE, stderr=PIPE)
12 for line in p.stdout.read().split('\n'):
13 if len(line) > 0:
14 print line
15 for line in p.stderr.read().split('\n'):
16 if len(line) > 0:
17 print line
18 return p.wait()
19
20 InteractiveShellABC.register(ZMQInteractiveShell)
@@ -27,7 +27,7 b' import zmq'
27
27
28 # Local imports.
28 # Local imports.
29 from IPython.config.configurable import Configurable
29 from IPython.config.configurable import Configurable
30 from IPython.core.interactiveshell import InteractiveShell, InteractiveShellABC
30 from IPython.zmq.zmqshell import ZMQInteractiveShell
31 from IPython.external.argparse import ArgumentParser
31 from IPython.external.argparse import ArgumentParser
32 from IPython.utils.traitlets import Instance
32 from IPython.utils.traitlets import Instance
33 from IPython.zmq.session import Session, Message
33 from IPython.zmq.session import Session, Message
@@ -50,7 +50,7 b' class Kernel(Configurable):'
50
50
51 def __init__(self, **kwargs):
51 def __init__(self, **kwargs):
52 super(Kernel, self).__init__(**kwargs)
52 super(Kernel, self).__init__(**kwargs)
53 self.shell = InteractiveShell.instance()
53 self.shell = ZMQInteractiveShell.instance()
54
54
55 # Build dict of handlers for message types
55 # Build dict of handlers for message types
56 msg_types = [ 'execute_request', 'complete_request',
56 msg_types = [ 'execute_request', 'complete_request',
General Comments 0
You need to be logged in to leave comments. Login now