aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/cli/run_command.zig1
-rw-r--r--test/cli/run/empty-file.js0
-rw-r--r--test/cli/run/empty-file.test.ts15
3 files changed, 15 insertions, 1 deletions
diff --git a/src/cli/run_command.zig b/src/cli/run_command.zig
index 3ef68b494..f31520cc8 100644
--- a/src/cli/run_command.zig
+++ b/src/cli/run_command.zig
@@ -973,7 +973,6 @@ pub const RunCommand = struct {
var shebang: string = shebang_buf[0..shebang_size];
shebang = std.mem.trim(u8, shebang, " \r\n\t");
- if (shebang.len == 0) break :possibly_open_with_bun_js;
if (strings.hasPrefixComptime(shebang, "#!")) {
const first_arg: string = if (bun.argv().len > 0) bun.span(bun.argv()[0]) else "";
const filename = std.fs.path.basename(first_arg);
diff --git a/test/cli/run/empty-file.js b/test/cli/run/empty-file.js
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/test/cli/run/empty-file.js
diff --git a/test/cli/run/empty-file.test.ts b/test/cli/run/empty-file.test.ts
new file mode 100644
index 000000000..f29162bf7
--- /dev/null
+++ b/test/cli/run/empty-file.test.ts
@@ -0,0 +1,15 @@
+import { it, expect } from "bun:test";
+import { bunEnv, bunExe } from "harness";
+import { join } from "path";
+
+it("should execute empty scripts", () => {
+ const { stdout, stderr, exitCode } = Bun.spawnSync({
+ cmd: [bunExe(), "run", "--bun", join(import.meta.dir, "empty-file.js")],
+ env: bunEnv,
+ stdout: "pipe",
+ stderr: "pipe",
+ });
+ expect(stdout.toString()).toBeEmpty();
+ expect(stderr.toString()).toBeEmpty();
+ expect(exitCode).toBe(0);
+});