diff options
author | 2022-08-20 23:03:15 -0700 | |
---|---|---|
committer | 2022-08-20 23:03:50 -0700 | |
commit | 83e4d04ce70c36e8461afe6f9f9c5547f5221fa2 (patch) | |
tree | 80209b71aea373e33abf1e7bc092ef75d40806de /src | |
parent | 8901d23685c94a32b2e09453695d036c6b8eacf8 (diff) | |
download | bun-83e4d04ce70c36e8461afe6f9f9c5547f5221fa2.tar.gz bun-83e4d04ce70c36e8461afe6f9f9c5547f5221fa2.tar.zst bun-83e4d04ce70c36e8461afe6f9f9c5547f5221fa2.zip |
wip support #!
Diffstat (limited to 'src')
-rw-r--r-- | src/cli/run_command.zig | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/cli/run_command.zig b/src/cli/run_command.zig index 9a56041b3..0f440d453 100644 --- a/src/cli/run_command.zig +++ b/src/cli/run_command.zig @@ -796,7 +796,12 @@ pub const RunCommand = struct { if (shebang.len == 0) break :possibly_open_with_bun_js; if (shebang.len > 2 and strings.eqlComptimeIgnoreLen(shebang[0..2], "#!")) { - break :possibly_open_with_bun_js; + const first_arg: string = if (std.os.argv.len > 0) bun.span(std.os.argv[0]) else ""; + const filename = std.fs.path.basename(first_arg); + // are we attempting to run the script with bun? + if (!strings.contains(shebang, filename)) { + break :possibly_open_with_bun_js; + } } Global.configureAllocator(.{ .long_running = true }); |