From ce54923847bd3076acd8c78fe2b0464eae757db0 2006-02-10 15:55:09 From: vivainio Date: 2006-02-10 15:55:09 Subject: [PATCH] use popen in genutils.getoutput --- diff --git a/IPython/genutils.py b/IPython/genutils.py index ee718c3..205d50e 100644 --- a/IPython/genutils.py +++ b/IPython/genutils.py @@ -5,7 +5,7 @@ General purpose utilities. This is a grab-bag of stuff I find useful in most programs I write. Some of these things are also convenient when working at the command line. -$Id: genutils.py 1126 2006-02-06 02:31:40Z fperez $""" +$Id: genutils.py 1139 2006-02-10 15:55:09Z vivainio $""" #***************************************************************************** # Copyright (C) 2001-2006 Fernando Perez. @@ -375,11 +375,19 @@ def getoutput(cmd,verbose=0,debug=0,header='',split=0): - split(0): if true, the output is returned as a list split on newlines. Note: a stateful version of this function is available through the - SystemExec class.""" + SystemExec class. + + This is pretty much deprecated and rarely used, + genutils.getoutputerror may be what you need. + + """ if verbose or debug: print header+cmd if not debug: - output = commands.getoutput(cmd) + output = os.popen(cmd).read() + # stipping last \n is here for backwards compat. + if output.endswith('\n'): + output = output[:-1] if split: return output.split('\n') else: diff --git a/doc/ChangeLog b/doc/ChangeLog index d9adf06..cbfb4f5 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,3 +1,7 @@ +2006-02-10 Ville Vainio + + * genutils.py: getoutput now works in win32 too + 2006-02-09 Ville Vainio * test/*: Added a unit testing framework (finally).