diff options
author | Jesus Cea <jcea@jcea.es> | 2012-10-05 05:32:10 +0200 |
---|---|---|
committer | Jesus Cea <jcea@jcea.es> | 2012-10-05 05:32:10 +0200 |
commit | 9b1bc4236bf3e67bbbc3cf03325d2f2bbda95be4 (patch) | |
tree | b95aaafed708ccd9762d2b7d130580e2be943409 /Lib/platform.py | |
parent | 7952e6e0b5fee69b0d182493d7c041dcc230d880 (diff) | |
parent | fe5c8b7876b3d8e381e147c8c7c8d1abfdb91236 (diff) | |
download | cpython-9b1bc4236bf3e67bbbc3cf03325d2f2bbda95be4.tar.gz |
MERGE: #16112: platform.architecture does not correctly escape argument to /usr/bin/file. Fix original patch
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 baead5cdaa..1ab9c99b45 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 |