From 61cbcbd69191b35ec85b30513d15541c5251601f Mon Sep 17 00:00:00 2001 From: Joakim Carlstein Date: Mon, 5 Feb 2024 15:46:56 +0100 Subject: [PATCH] fix(cli): force exiting after 10 seconds should not change the exit code If all migrations have been run successfully we want the exit code to be 0 even though we had to force exit the process. This is because on some platforms (e.g. Bun) all handles are not cleaned up the same as in NodeJS, so lets be forgiving. --- .changeset/wicked-months-kneel.md | 5 +++++ packages/cli/src/cli.ts | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 .changeset/wicked-months-kneel.md diff --git a/.changeset/wicked-months-kneel.md b/.changeset/wicked-months-kneel.md new file mode 100644 index 0000000..a93d580 --- /dev/null +++ b/.changeset/wicked-months-kneel.md @@ -0,0 +1,5 @@ +--- +'@emigrate/cli': patch +--- + +Force exiting after 10 seconds should not change the exit code, i.e. if all migrations have run successfully the exit code should be 0 diff --git a/packages/cli/src/cli.ts b/packages/cli/src/cli.ts index daf7976..2ba0513 100644 --- a/packages/cli/src/cli.ts +++ b/packages/cli/src/cli.ts @@ -602,5 +602,5 @@ await main(process.argv.slice(2), controller.signal); setTimeout(() => { console.error('Process did not exit within 10 seconds, forcing exit'); - process.exit(1); + process.exit(process.exitCode); }, 10_000).unref();