# HG changeset patch # User catherine@localhost # Date 1213021726 14400 # Node ID 49de899a05a81f57ef076087d3b0d6bf28a8211f # Parent 26e33f64f68ea250806f0c9fb6c7390d319a95f8 new unified pipe and redirect works on wc diff -r 26e33f64f68e -r 49de899a05a8 cmd2.py --- 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)