Nick Coghlan <ncogh...@gmail.com> added the comment:

It is indeed unfortunate that these two functions weren't killed off in the 
Py3k transition instead of being migrated from the commands module to 
subprocess (their current implementation runs counter to the entire subprocess 
security design by implicitly invoking the shell).

Probably the most straightforward way to make them better behaved is to move 
them over to being based on subprocess.Popen:

def getstatusoutput(cmd):
    try:
        data = check_output(cmd, shell=True, universal_newlines=True, 
stderr=STDOUT)
        status = 0
    except CalledProcessError as ex:
        data = ex.output
        status = ex.returncode
    return status, data

def getoutput(cmd):
    return getstatusoutput(cmd)[1]

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue9922>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to