mirror of
https://github.com/ZTatman/myst.git
synced 2026-11-21 20:37:58 +00:00
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
This commit is contained in:
parent
a7f30a0d3a
commit
55d45adec8
1 changed files with 4 additions and 2 deletions
|
|
@ -105,7 +105,8 @@ async function init(opts: { output?: string }) {
|
||||||
|
|
||||||
if (p.isCancel(choice) || choice === "cancel") {
|
if (p.isCancel(choice) || choice === "cancel") {
|
||||||
p.cancel("\nOperation cancelled.");
|
p.cancel("\nOperation cancelled.");
|
||||||
process.exit(0);
|
process.exitCode = 0;
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (choice === "view") {
|
if (choice === "view") {
|
||||||
|
|
@ -173,7 +174,8 @@ async function init(opts: { output?: string }) {
|
||||||
{
|
{
|
||||||
onCancel: () => {
|
onCancel: () => {
|
||||||
p.cancel("\nOperation cancelled.");
|
p.cancel("\nOperation cancelled.");
|
||||||
process.exit(0);
|
process.exitCode = 0;
|
||||||
|
throw new Error("Operation cancelled");
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue