diff options
author | 2022-01-22 16:25:21 -0800 | |
---|---|---|
committer | 2022-01-22 16:25:21 -0800 | |
commit | 08bc06dfe0e12eedfa443a7f8fc95711848e9813 (patch) | |
tree | 57f4c56f45d3fe46717e7ae4e011472fc2368599 | |
parent | f4fbf8429448258195c4ec7e7f25100167048d28 (diff) | |
download | bun-08bc06dfe0e12eedfa443a7f8fc95711848e9813.tar.gz bun-08bc06dfe0e12eedfa443a7f8fc95711848e9813.tar.zst bun-08bc06dfe0e12eedfa443a7f8fc95711848e9813.zip |
No more leading `./` necessary to pass a script to bun to execute
-rw-r--r-- | src/cli.zig | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/cli.zig b/src/cli.zig index 40b59b928..8974704db 100644 --- a/src/cli.zig +++ b/src/cli.zig @@ -963,7 +963,13 @@ pub const Command = struct { Global.configureAllocator(.{ .long_running = true }); - BunJS.Run.boot(ctx, file, ctx.allocator.dupe(u8, file_path) catch unreachable) catch |err| { + // the case where this doesn't work is if the script name on disk doesn't end with a known JS-like file extension + var absolute_script_path = std.os.getFdPath(file.handle, &script_name_buf) catch break :possibly_open_with_bun_js; + BunJS.Run.boot( + ctx, + file, + absolute_script_path, + ) catch |err| { if (Output.enable_ansi_colors) { ctx.log.printForLogLevelWithEnableAnsiColors(Output.errorWriter(), true) catch {}; } else { |