Commit 9209b9f7 authored by Jason R. Coombs's avatar Jason R. Coombs

Decode file as latin-1 when opening to ensure decoding any bytes.

parent ad794c28
......@@ -1801,9 +1801,8 @@ def is_python(text, filename='<string>'):
def is_sh(executable):
"""Determine if the specified executable is a .sh (contains a #! line)"""
try:
fp = open(executable)
with open(executable, encoding='latin-1') as fp:
magic = fp.read(2)
fp.close()
except (OSError, IOError):
return executable
return magic == '#!'
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment