diff options
-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 }); |