Show More
@@ -5,7 +5,7 b' General purpose utilities.' | |||
|
5 | 5 | This is a grab-bag of stuff I find useful in most programs I write. Some of |
|
6 | 6 | these things are also convenient when working at the command line. |
|
7 | 7 | |
|
8 |
$Id: genutils.py 11 |
|
|
8 | $Id: genutils.py 1139 2006-02-10 15:55:09Z vivainio $""" | |
|
9 | 9 | |
|
10 | 10 | #***************************************************************************** |
|
11 | 11 | # Copyright (C) 2001-2006 Fernando Perez. <fperez@colorado.edu> |
@@ -375,11 +375,19 b" def getoutput(cmd,verbose=0,debug=0,header='',split=0):" | |||
|
375 | 375 | - split(0): if true, the output is returned as a list split on newlines. |
|
376 | 376 | |
|
377 | 377 | Note: a stateful version of this function is available through the |
|
378 |
SystemExec class. |
|
|
378 | SystemExec class. | |
|
379 | ||
|
380 | This is pretty much deprecated and rarely used, | |
|
381 | genutils.getoutputerror may be what you need. | |
|
382 | ||
|
383 | """ | |
|
379 | 384 | |
|
380 | 385 | if verbose or debug: print header+cmd |
|
381 | 386 | if not debug: |
|
382 |
output = |
|
|
387 | output = os.popen(cmd).read() | |
|
388 | # stipping last \n is here for backwards compat. | |
|
389 | if output.endswith('\n'): | |
|
390 | output = output[:-1] | |
|
383 | 391 | if split: |
|
384 | 392 | return output.split('\n') |
|
385 | 393 | else: |
General Comments 0
You need to be logged in to leave comments.
Login now