summaryrefslogtreecommitdiff
path: root/Lib/platform.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/platform.py')
-rwxr-xr-xLib/platform.py7
1 files changed, 3 insertions, 4 deletions
diff --git a/Lib/platform.py b/Lib/platform.py
index 6776a2515d..f2dd5206e3 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