From e229f413d635b78a59b0d4ef1a9aa0f3967c0fd4 Mon Sep 17 00:00:00 2001 From: Zach Barham Date: Tue, 14 Sep 2021 22:38:04 +1000 Subject: [PATCH] fix: check whole hashbang line if it is /usr/bin/env (#66) Because pnpm uses the hashbang `/usr/bin/env node`, only checking until the first space will miss the `node`. We only do this if it is the env call, so that it doesn't break any existing code (`/usr/bin/env` would fail the check anyway) --- pkg/node-modules/rebuild.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pkg/node-modules/rebuild.go b/pkg/node-modules/rebuild.go index e79c2fb..a5a8a97 100644 --- a/pkg/node-modules/rebuild.go +++ b/pkg/node-modules/rebuild.go @@ -442,6 +442,8 @@ func readHashBang(path string) (string, error) { end := strings.IndexAny(str, "\r\n\t ") if end == -1 { end = len(str) + } else if str[0:end] == "/usr/bin/env" { + end = strings.IndexAny(str, "\r\n\t") } return str[0:end], nil } else {