diff options
author | Jesus Cea <jcea@jcea.es> | 2012-10-05 02:58:38 (GMT) |
---|---|---|
committer | Jesus Cea <jcea@jcea.es> | 2012-10-05 02:58:38 (GMT) |
commit | adc8211e0084126c1d3190022929c3bffef12ce6 (patch) | |
tree | 9bc54eade4b6c40b0bd426c9408209628b7b64e4 /Lib/platform.py | |
parent | 4ca222d4d5469bd0c9d188b9d007597798919260 (diff) | |
download | cpython-adc8211e0084126c1d3190022929c3bffef12ce6.zip cpython-adc8211e0084126c1d3190022929c3bffef12ce6.tar.gz cpython-adc8211e0084126c1d3190022929c3bffef12ce6.tar.bz2 |
#16112: platform.architecture does not correctly escape argument to /usr/bin/file. Use 'communicate()' and decode the bytes
Diffstat (limited to 'Lib/platform.py')
-rwxr-xr-x | Lib/platform.py | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/Lib/platform.py b/Lib/platform.py index 6776a25..f2dd520 100755 --- a/Lib/platform.py +++ b/Lib/platform.py @@ -997,12 +997,11 @@ def _syscmd_file(target,default=''): return default target = _follow_symlinks(target) try: - with open(DEV_NULL) as dev_null: - proc = subprocess.Popen(['file', '-b', '--', target], - stdout=subprocess.PIPE, stderr=dev_null) + proc = subprocess.Popen(['file', '-b', '--', target], + stdout=subprocess.PIPE, stderr=dev_null) except (AttributeError,os.error): return default - output = proc.stdout.read() + output = proc.communicate()[0].decode("latin-1") rc = proc.wait() if not output or rc: return default |