Commit 071fd7c2 authored by Julien Muchembled's avatar Julien Muchembled

Fix shebang workaround on Python 3

This fixes up commit d5199b9d
("Add support for Python 3").
parent 4e38cc88
Pipeline #18603 passed with stage
in 0 seconds
......@@ -333,8 +333,8 @@ echo %s
if not stat.S_ISREG(st_mode):
continue
with open(f_abspath, 'rb') as f:
header = f.readline(128)
if header.startswith(b'#!') and header[-1] != b'\n':
header = f.readline(128) # 256 starting from Linux 5.1
if header.startswith(b'#!') and header[-1:] != b'\n':
os.rename(f_abspath, f_abspath + '.shebang')
with open(f_abspath, 'w') as f:
os.fchmod(f.fileno(), stat.S_IMODE(st_mode))
......
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