]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
MERGE: #16112: platform.architecture does not correctly escape argument to /usr/bin...
authorJesus Cea <jcea@jcea.es>
Fri, 5 Oct 2012 03:31:31 +0000 (05:31 +0200)
committerJesus Cea <jcea@jcea.es>
Fri, 5 Oct 2012 03:31:31 +0000 (05:31 +0200)
1  2 
Lib/platform.py

diff --cc Lib/platform.py
index dd318fe7842ad0192b8208ee92ba060a6a28330f,eedc11c518d108f2e22cf962f0f6c857025553a6..769fe8846dae9f173036fb6751ce35e6212afff0
@@@ -924,13 -997,11 +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")
++    output = proc.communicate()[0].decode('latin-1')
      rc = proc.wait()
      if not output or rc:
          return default