Wait for a command to complete. Completion is signaled by a sentinel character, ASCII(127) appearing in the output stream. Wait for the sentinel and return the output, including trailing newline. verbose: print output interactively
( self, verbose=False, findPid=True )
| 363 | return data |
| 364 | |
| 365 | def waitOutput( self, verbose=False, findPid=True ): |
| 366 | """Wait for a command to complete. |
| 367 | Completion is signaled by a sentinel character, ASCII(127) |
| 368 | appearing in the output stream. Wait for the sentinel and return |
| 369 | the output, including trailing newline. |
| 370 | verbose: print output interactively""" |
| 371 | log = info if verbose else debug |
| 372 | output = '' |
| 373 | while self.waiting: |
| 374 | data = self.monitor( findPid=findPid ) |
| 375 | output += data |
| 376 | log( data ) |
| 377 | return output |
| 378 | |
| 379 | def cmd( self, *args, **kwargs ): |
| 380 | """Send a command, wait for output, and return it. |