diff options
author | Eliot Horowitz <eliot@10gen.com> | 2010-02-04 10:21:36 -0500 |
---|---|---|
committer | Eliot Horowitz <eliot@10gen.com> | 2010-02-04 10:21:36 -0500 |
commit | f8273464b7daa74ed4a06952eccc892fb14b0f05 (patch) | |
tree | 6e70eae6f110b31b0038b39f00fec7341af4168c /buildscripts/utils.py | |
parent | effedd950de374a91ab415e66f405a2ae4a3885b (diff) | |
download | mongo-f8273464b7daa74ed4a06952eccc892fb14b0f05.tar.gz |
bb files
Diffstat (limited to 'buildscripts/utils.py')
-rw-r--r-- | buildscripts/utils.py | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/buildscripts/utils.py b/buildscripts/utils.py new file mode 100644 index 00000000000..06b7fa3c687 --- /dev/null +++ b/buildscripts/utils.py @@ -0,0 +1,23 @@ + +import re + +# various utilities that are handy + +def execsys( args ): + import subprocess + if isinstance( args , str ): + r = re.compile( "\s+" ) + args = r.split( args ) + p = subprocess.Popen( args , stdout=subprocess.PIPE , stderr=subprocess.PIPE ) + r = p.communicate() + return r; + +def getprocesslist(): + raw = "" + try: + raw = execsys( "/bin/ps -ax" )[0] + except Exception,e: + print( "can't get processlist: " + str( e ) ) + + r = re.compile( "[\r\n]+" ) + return r.split( raw ) |