Skip to content

Commit a43e629

Browse files
committed
fix(cli): move spinner cleanup to finally block
- Moved spinner.stop() from catch block to finally block - Ensures interval cleanup in all edge cases (idempotent call) - Prevents potential memory leak if exception bypasses catch
1 parent d5badde commit a43e629

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

cli/bin/postgres-ai.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -995,7 +995,6 @@ program
995995
console.log(JSON.stringify(reports, null, 2));
996996
}
997997
} catch (error) {
998-
spinner.stop();
999998
if (error instanceof RpcError) {
1000999
for (const line of formatRpcErrorForDisplay(error)) {
10011000
console.error(line);
@@ -1006,6 +1005,8 @@ program
10061005
}
10071006
process.exitCode = 1;
10081007
} finally {
1008+
// Always stop spinner to prevent interval leak (idempotent - safe to call multiple times)
1009+
spinner.stop();
10091010
if (client) {
10101011
await client.end();
10111012
}

0 commit comments

Comments
 (0)