Mercurial > python-cmd2
comparison cmd2.py @ 72:6031a06bb6d7
oops, statement/suffix problems
author | catherine@Elli.myhome.westell.com |
---|---|
date | Wed, 25 Jun 2008 12:53:03 -0400 |
parents | ea1697be3d00 |
children | 101283b63e1b |
comparison
equal
deleted
inserted
replaced
71:ea1697be3d00 | 72:6031a06bb6d7 |
---|---|
263 statekeeper = None | 263 statekeeper = None |
264 stop = 0 | 264 stop = 0 |
265 | 265 |
266 inputFrom = self.input_source_finder(suffix) | 266 inputFrom = self.input_source_finder(suffix) |
267 if inputFrom: | 267 if inputFrom: |
268 statement, source = inputFrom[0], inputFrom[-1] | 268 source = inputFrom[-1] |
269 if source: | 269 if source: |
270 statement = '%s %s' % (statement, self.fileimport(statement=statement, source=source)) | 270 statement = '%s %s' % (statement, self.fileimport(statement=statement, source=source)) |
271 else: | 271 else: |
272 statement = '%s %s' % (statement, getPasteBuffer()) | 272 statement = '%s %s' % (statement, getPasteBuffer()) |
273 | 273 |
274 pipeTo = self.pipe_destination_finder(suffix) | 274 pipeTo = self.pipe_destination_finder(suffix) |
275 if pipeTo: | 275 if pipeTo: |
276 statement, pipeTo = pipeTo[0], pipeTo[-1] | 276 pipeTo = pipeTo[-1] |
277 statekeeper = Statekeeper(self, ('stdout',)) | 277 statekeeper = Statekeeper(self, ('stdout',)) |
278 pipeTo = subprocess.Popen(pipeTo, shell=True, stdout=subprocess.PIPE, stdin=subprocess.PIPE) | 278 pipeTo = subprocess.Popen(pipeTo, shell=True, stdout=subprocess.PIPE, stdin=subprocess.PIPE) |
279 self.stdout = pipeTo.stdin | 279 self.stdout = pipeTo.stdin |
280 else: # can't pipe output AND send it to a file | 280 else: # can't pipe output AND send it to a file |
281 outputTo = self.output_destination_finder(suffix) | 281 outputTo = self.output_destination_finder(suffix) |
282 if outputTo: | 282 if outputTo: |
283 statement, destination = outputTo[0], outputTo[-1] | 283 destination = outputTo[-1] |
284 statekeeper = Statekeeper(self, ('stdout',)) | 284 statekeeper = Statekeeper(self, ('stdout',)) |
285 mode = ((outputTo[1][0] == '>>') and 'a') or 'w' | 285 mode = ((outputTo[1][0] == '>>') and 'a') or 'w' |
286 if destination: | 286 if destination: |
287 self.stdout = open(destination, mode) | 287 self.stdout = open(destination, mode) |
288 else: | 288 else: |