Skip to content

Commit 5e09d87

Browse files
committed
fix summary on exit
1 parent 4f5f6ca commit 5e09d87

File tree

1 file changed

+15
-9
lines changed

1 file changed

+15
-9
lines changed

src/commands/init.tsx

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -375,34 +375,40 @@ async function initAction(): Promise<void> {
375375

376376
const result = await wizardPromise;
377377

378+
await renderer.idle();
378379
renderer.destroy();
379380

381+
// Use process.stdout/stderr.write directly to bypass the library's
382+
// console capture (which has a bug in restoreOriginalConsole that
383+
// re-captures immediately after restoring)
384+
const print = (msg: string) => process.stdout.write(`${msg}\n`);
385+
const printErr = (msg: string) => process.stderr.write(`${msg}\n`);
386+
380387
if (result.type === 'cancelled') {
381-
console.log('\nCancelled. No changes made.');
388+
print('\nCancelled. No changes made.');
382389
return;
383390
}
384391

385392
if (result.type === 'error') {
386-
console.error(`\nError: ${result.message}`);
393+
printErr(`\nError: ${result.message}`);
387394
process.exit(1);
388395
}
389396

390397
const config = result.config;
391398
await writeConfig(config);
392399

393-
console.log('\nConfiguration saved to .conductor/config.yml');
394-
console.log('');
395-
console.log('Summary:');
400+
print('\nConfiguration saved to .conductor/config.yml');
401+
print('\nSummary:');
396402

397403
if (config.tigerServiceId === null) {
398-
console.log(' Database: (None) - forks will be skipped by default');
404+
print(' Database: (None) - forks will be skipped by default');
399405
} else if (config.tigerServiceId) {
400-
console.log(` Database: ${config.tigerServiceId}`);
406+
print(` Database: ${config.tigerServiceId}`);
401407
}
402408

403-
console.log(` Agent: ${config.agent}`);
409+
print(` Agent: ${config.agent}`);
404410
if (config.model) {
405-
console.log(` Model: ${config.model}`);
411+
print(` Model: ${config.model}`);
406412
}
407413
}
408414

0 commit comments

Comments
 (0)