Skip to content

Commit

Permalink
fix: for running cli-ts-node-esm use exit code from child process (#1…
Browse files Browse the repository at this point in the history
…0030)

Use child process exit code in parent process to properly indicate that child process (migration running) fails

Closes: #10029
  • Loading branch information
pahuta committed May 9, 2023
1 parent 7c5627f commit a188b1d
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/cli-ts-node-esm.ts
Expand Up @@ -3,8 +3,8 @@ import { spawnSync } from "child_process"

if ((process.env["NODE_OPTIONS"] || "").includes("--loader ts-node"))
require("./cli")
else
spawnSync(process.argv[0], process.argv.slice(1), {
else {
const childProcess = spawnSync(process.argv[0], process.argv.slice(1), {
stdio: "inherit",
env: {
...process.env,
Expand All @@ -18,3 +18,6 @@ else
},
windowsHide: true,
})

process.exit(childProcess.status || 0)
}

0 comments on commit a188b1d

Please sign in to comment.