summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJesus Cea <jcea@jcea.es>2012-10-05 03:32:10 (GMT)
committerJesus Cea <jcea@jcea.es>2012-10-05 03:32:10 (GMT)
commitb451fd65deb175b8aa0bb3faec28a302be20d25d (patch)
tree56f49233009e6c6137fe96a8653c498a53dd3069
parent6efe9dff14857770a6436c0ea83029f570692131 (diff)
parentcb95996fdc6956365642dd42f86dfb380f923fa5 (diff)
downloadcpython-b451fd65deb175b8aa0bb3faec28a302be20d25d.zip
cpython-b451fd65deb175b8aa0bb3faec28a302be20d25d.tar.gz
cpython-b451fd65deb175b8aa0bb3faec28a302be20d25d.tar.bz2
MERGE: #16112: platform.architecture does not correctly escape argument to /usr/bin/file. Fix original patch
-rwxr-xr-xLib/platform.py7
1 files changed, 3 insertions, 4 deletions
diff --git a/Lib/platform.py b/Lib/platform.py
index baead5c..1ab9c99 100755
--- a/Lib/platform.py
+++ b/Lib/platform.py
@@ -924,13 +924,12 @@ 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', target],
+ stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
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