From a4cf6d2ef1a77084825e337d05747577440d29f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lauris=20Buk=C5=A1is-Haberkorns?= Date: Mon, 5 Aug 2019 14:44:52 +0300 Subject: [PATCH] If osascript is called with argument -l it could be different language so do not relay on it MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Lauris Bukšis-Haberkorns --- common.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/common.go b/common.go index 99096c9..058d884 100644 --- a/common.go +++ b/common.go @@ -319,6 +319,12 @@ func getInterpreter(data []byte) (interpreter string) { 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 }