mirror of
https://github.com/ralsina/tartrazine.git
synced 2025-06-19 06:33:06 -03:00
Fix 🐛 on file starting with single shebang
This commit is contained in:
@ -284,14 +284,16 @@ func getInterpreter(data []byte) (interpreter string) {
|
||||
|
||||
// skip shebang
|
||||
line = bytes.TrimSpace(line[2:])
|
||||
|
||||
splitted := bytes.Fields(line)
|
||||
if len(splitted) == 0 {
|
||||
return ""
|
||||
}
|
||||
|
||||
if bytes.Contains(splitted[0], []byte("env")) {
|
||||
if len(splitted) > 1 {
|
||||
interpreter = string(splitted[1])
|
||||
}
|
||||
} else {
|
||||
|
||||
splittedPath := bytes.Split(splitted[0], []byte{'/'})
|
||||
interpreter = string(splittedPath[len(splittedPath)-1])
|
||||
}
|
||||
|
Reference in New Issue
Block a user