Skip to content

Commit a188b1d

Browse files
authored
fix: for running cli-ts-node-esm use exit code from child process (#10030)
Use child process exit code in parent process to properly indicate that child process (migration running) fails Closes: #10029
1 parent 7c5627f commit a188b1d

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/cli-ts-node-esm.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ import { spawnSync } from "child_process"
33

44
if ((process.env["NODE_OPTIONS"] || "").includes("--loader ts-node"))
55
require("./cli")
6-
else
7-
spawnSync(process.argv[0], process.argv.slice(1), {
6+
else {
7+
const childProcess = spawnSync(process.argv[0], process.argv.slice(1), {
88
stdio: "inherit",
99
env: {
1010
...process.env,
@@ -18,3 +18,6 @@ else
1818
},
1919
windowsHide: true,
2020
})
21+
22+
process.exit(childProcess.status || 0)
23+
}

0 commit comments

Comments
 (0)