changeset 13:9f0d13830f6c

Change terminate_shell for non-inplace run(). For non-inplace run(), we don't need to redirect stdout/stdint. So, we don't place terminate_shell after the pipe. It is run after all previous works finished.
author Thinker K.F. Li <thinker@codemud.net>
date Tue, 29 Mar 2011 15:29:34 +0800
parents a5699b110308
children d37e932a727c
files shada/pysh.py
diffstat 1 files changed, 5 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/shada/pysh.py	Tue Mar 29 15:21:53 2011 +0800
+++ b/shada/pysh.py	Tue Mar 29 15:29:34 2011 +0800
@@ -4,16 +4,6 @@
 
 def _run(cmd, inplace):
     def terminate_shell(args, env, session):
-        yield
-        while True:
-            data = session.recv()
-            if data == None:
-                break
-
-            sys.stdout.write(data)
-            yield
-            pass
-        session.exit(0)
         server.close()
         pass
 
@@ -58,7 +48,11 @@
                 pass
             pass
         
-        os.system('(' + cmd + ')| $py terminate_shell')
+        if inplace:
+            os.system('(' + cmd + ')| $py terminate_shell')
+        else:
+            os.system(cmd + '; $py terminate_shell')
+            pass
         sys.exit(0)
         pass