From 55d45adec8a66940aed02b3ae2aff6aac2df3dae Mon Sep 17 00:00:00 2001 From: ZTatman Date: Sun, 12 Apr 2026 18:22:06 -0400 Subject: [PATCH] fix(cli): replace process.exit(0) with proper exit handling - Use process.exitCode + return in select cancel path - Use process.exitCode + throw in group onCancel handler - Allows finally blocks to run for cleanup --- packages/cli/src/commands/config/init.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/cli/src/commands/config/init.ts b/packages/cli/src/commands/config/init.ts index 5b0ce20..578e388 100644 --- a/packages/cli/src/commands/config/init.ts +++ b/packages/cli/src/commands/config/init.ts @@ -105,7 +105,8 @@ async function init(opts: { output?: string }) { if (p.isCancel(choice) || choice === "cancel") { p.cancel("\nOperation cancelled."); - process.exit(0); + process.exitCode = 0; + return; } if (choice === "view") { @@ -173,7 +174,8 @@ async function init(opts: { output?: string }) { { onCancel: () => { p.cancel("\nOperation cancelled."); - process.exit(0); + process.exitCode = 0; + throw new Error("Operation cancelled"); }, }, );