changeset 52:49de899a05a8

new unified pipe and redirect works on wc
author catherine@localhost
date Mon, 09 Jun 2008 10:28:46 -0400
parents 26e33f64f68e
children 2811505b0969
files cmd2.py
diffstat 1 files changed, 4 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/cmd2.py	Mon Jun 09 10:20:38 2008 -0400
+++ b/cmd2.py	Mon Jun 09 10:28:46 2008 -0400
@@ -275,11 +275,12 @@
                 if redirect == self._TO_PASTE_BUFFER:
                     self.stdout.seek(0)
                     writeToPasteBuffer(self.stdout.read())
+                elif isinstance(redirect, subprocess.Popen):
+                    for result in redirect.communicate():              
+                        statekeeper.stdout.write(result or '')                        
                 self.stdout.close()
                 statekeeper.restore()
-                if isinstance(redirect, subprocess.Popen):
-                    for result in redirect.communicate():              
-                        self.stdout.write(result or '')                                     
+                                 
             return stop        
         
     statementEndPattern = re.compile(r'[%s]\s*$' % terminators)