This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author ncoghlan
Recipients astrand, debatem1, gregory.p.smith, ncoghlan, ned.deily, pitrou, rosslagerwall, vstinner
Date 2011-12-22.14:04:43
SpamBayes Score 0.00020946651
Marked as misclassified No
Message-id <1324562684.65.0.961551640894.issue9922@psf.upfronthosting.co.za>
In-reply-to
Content
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]
History
Date User Action Args
2011-12-22 14:04:44ncoghlansetrecipients: + ncoghlan, gregory.p.smith, astrand, pitrou, vstinner, ned.deily, debatem1, rosslagerwall
2011-12-22 14:04:44ncoghlansetmessageid: <1324562684.65.0.961551640894.issue9922@psf.upfronthosting.co.za>
2011-12-22 14:04:44ncoghlanlinkissue9922 messages
2011-12-22 14:04:43ncoghlancreate