# HG changeset patch # User catherine@localhost # Date 1212785469 14400 # Node ID 8926b72d828e1e54133106edd5604a468456ee98 # Parent 34fb410954518a3a79d2ef31ce3385f96a247a80 first success with pipe diff -r 34fb41095451 -r 8926b72d828e cmd2.py --- a/cmd2.py Tue Jun 03 15:26:54 2008 -0400 +++ b/cmd2.py Fri Jun 06 16:51:09 2008 -0400 @@ -244,9 +244,10 @@ statekeeper = Statekeeper(self, ('stdout',)) redirect = subprocess.Popen(redirect, shell=True, stdout=subprocess.PIPE, stdin=subprocess.PIPE) self.stdout = redirect.stdin - stop = cmd.Cmd.onecmd(self, statement) + stop = cmd.Cmd.onecmd(self, statement) statekeeper.restore() - self.stdout.write(redirect.stdout.read()) + for result in redirect.communicate(): + self.stdout.write(result or '') return stop # didn't record in history else: statement, redirect, mode = self.parseRedirectors(statement)