Skip to content

Commit

Permalink
feat: Add support for /bin/env
Browse files Browse the repository at this point in the history
Some places use /bin/env instead of /usr/bin/env for interpreted
scripts. Support both.
  • Loading branch information
psa committed Dec 17, 2024
1 parent ce50079 commit 546491b
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions identify/identify.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,10 @@ def parse_shebang(bytesio: IO[bytes]) -> tuple[str, ...]:
cmd = cmd[2:]
elif cmd[:1] == ('/usr/bin/env',):
cmd = cmd[1:]
elif cmd[:2] == ('/bin/env', '-S'):
cmd = cmd[2:]
elif cmd[:1] == ('/bin/env',):
cmd = cmd[1:]

if cmd == ('nix-shell',):
return _parse_nix_shebang(bytesio, cmd)
Expand Down

0 comments on commit 546491b

Please sign in to comment.