Skip to content

Commit 69c84de

Browse files
committed
fix: catch unhandled promise rejection in non-interactive CLI path
runNonInteractive() is async but was called fire-and-forget. If an unexpected error escapes the internal try/catch, Node.js would emit an unhandled rejection instead of clean JSON. Add .catch() to ensure errors always produce valid JSON output with exit code 1.
1 parent 6288b80 commit 69c84de

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

source/cli.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,10 @@ if (isNonInteractive) {
8585
name: cli.flags.name,
8686
mode: cli.flags.mode,
8787
features: cli.flags.features,
88+
}).catch((error) => {
89+
const message = error instanceof Error ? error.message : String(error)
90+
console.log(JSON.stringify({ success: false, error: message }))
91+
process.exit(1)
8892
})
8993
} else {
9094
const run = async () => {

0 commit comments

Comments
 (0)