Skip to content

Commit

Permalink
fix: check whole hashbang line if it is /usr/bin/env (#66)
Browse files Browse the repository at this point in the history
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)
  • Loading branch information
Alduino authored Sep 14, 2021
1 parent b44c187 commit e229f41
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions pkg/node-modules/rebuild.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit e229f41

Please sign in to comment.