fix(cli): exit cleanly when quitting out of CLI

This commit is contained in:
Cory Dransfeldt 2025-06-06 04:34:37 -07:00
parent 862c8e1c7f
commit 8890f7dcfc
No known key found for this signature in database
4 changed files with 18 additions and 3 deletions

11
cli/lib/handlers.js Normal file
View file

@ -0,0 +1,11 @@
export const handleExitError = (err, type = 'Unhandled error') => {
const isExit = err?.name === 'ExitPromptError' || err?.code === 'ERR_CANCELED' || err?.message?.includes('SIGINT');
if (isExit) {
console.log('\n👋 Exiting. Cya!\n');
process.exit(0);
}
console.error(`${type}:`, err);
process.exit(1);
}