--- e:\Python21\Lib\commands.py Tue Dec 17 13:21:36 2002 +++ commands.py Tue Dec 17 13:25:06 2002 @@ -24,9 +24,9 @@ # Module 'commands' # # Various tools for executing commands and looking at their output and status. -# -# NB This only works (and is only relevant) for UNIX. +import os +import sys # Get 'ls -l' status for an object into a string # @@ -49,10 +49,12 @@ # def getstatusoutput(cmd): """Return (status, output) of executing cmd in a shell.""" - import os - if - pipe = os.popen('{ ' + cmd + '; } 2>&1', 'r') - pipe = os.popen('"' + cmd + ';" 2>&1', 'r') + if sys.platform == 'win32': + cmd = '"%s" 2>&1' % cmd + else: + cmd = '{ %s; } 2>&1' % cmd + + pipe = os.popen(cmd, 'r') text = pipe.read() sts = pipe.close() if sts is None: sts = 0