diff options
author | 2023-08-06 17:43:24 -0700 | |
---|---|---|
committer | 2023-08-06 17:43:24 -0700 | |
commit | 3185ca2d9599de18bbdd18069d411c1d775d1535 (patch) | |
tree | d03ded780e1b4b16a189c35faced3b2e907058b4 | |
parent | b93f304c063698ada698eddc4321c5c7010e5e5d (diff) | |
download | bun-3185ca2d9599de18bbdd18069d411c1d775d1535.tar.gz bun-3185ca2d9599de18bbdd18069d411c1d775d1535.tar.zst bun-3185ca2d9599de18bbdd18069d411c1d775d1535.zip |
Running missing scripts exits with non-0 (#4026)
Co-authored-by: Yash Sharma <yashsharma@Yashs-MacBook-Air.local>
-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); +}); |