Merge pull request #237 from lafriks/feat/osascript_lang

Improve shebang detection for osascript when language is specified with -l argument
This commit is contained in:
Alexander 2019-08-06 11:59:10 +02:00 committed by GitHub
commit 5ce5a65ddf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -319,6 +319,12 @@ func getInterpreter(data []byte) (interpreter string) {
interpreter = interpreter[:strings.Index(interpreter, `.`)] interpreter = interpreter[:strings.Index(interpreter, `.`)]
} }
// If osascript is called with argument -l it could be different language so do not relay on it
// To match linguist behaviour, see ref https://github.com/github/linguist/blob/d95bae794576ab0ef2fcb41a39eb61ea5302c5b5/lib/linguist/shebang.rb#L63
if interpreter == "osascript" && bytes.Contains(line, []byte("-l")) {
interpreter = ""
}
return return
} }