diff options
-rw-r--r-- | src/cli/run_command.zig | 2 | ||||
-rw-r--r-- | test/regression/issue/4011.test.ts | 12 |
2 files changed, 13 insertions, 1 deletions
diff --git a/src/cli/run_command.zig b/src/cli/run_command.zig index 6a559b342..106e87a3c 100644 --- a/src/cli/run_command.zig +++ b/src/cli/run_command.zig @@ -1134,7 +1134,7 @@ pub const RunCommand = struct { if (comptime log_errors) { Output.prettyError("<r><red>error<r><d>:<r> missing script \"<b>{s}<r>\"\n", .{script_name_to_search}); - Global.exit(0); + Global.exit(1); } return false; diff --git a/test/regression/issue/4011.test.ts b/test/regression/issue/4011.test.ts new file mode 100644 index 000000000..a3db4270d --- /dev/null +++ b/test/regression/issue/4011.test.ts @@ -0,0 +1,12 @@ +import { expect, test } from "bun:test"; +import { bunEnv, bunExe } from "harness"; + +test("running a missing script should return non zero exit code", () => { + const { stdout, exitCode } = Bun.spawnSync({ + cmd: [bunExe(), "run", "missing.ts"], + env: bunEnv, + stderr: "inherit", + }); + + expect(exitCode).toBe(1); +}); |