Message150093
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] |
|
Date |
User |
Action |
Args |
2011-12-22 14:04:44 | ncoghlan | set | recipients:
+ ncoghlan, gregory.p.smith, astrand, pitrou, vstinner, ned.deily, debatem1, rosslagerwall |
2011-12-22 14:04:44 | ncoghlan | set | messageid: <1324562684.65.0.961551640894.issue9922@psf.upfronthosting.co.za> |
2011-12-22 14:04:44 | ncoghlan | link | issue9922 messages |
2011-12-22 14:04:43 | ncoghlan | create | |
|