fix(migrations): drop press-any-key block to avoid stdin wedge

showDeprecationWarnings ran setRawMode(true)/once('data')/setRawMode(false)/
pause() right before pi-tui's own stdin setup. That handoff is fragile —
buffered bytes and mode flips between the migration prompt and the TUI's
raw-mode setup can leave stdin cooked and line-buffered, producing the
'Enter does nothing + garbled typing' symptom.

Warnings now print non-blocking. They stay visible in scrollback above
the TUI, so users still see them without a blocking acknowledge step.
This commit is contained in:
ace-pm 2026-04-21 00:56:18 +02:00
parent e6676692fc
commit e63184f91d
No known key found for this signature in database

View file

@ -253,7 +253,9 @@ function migrateExtensionSystem(cwd: string): string[] {
}
/**
* Print deprecation warnings and wait for keypress.
* Print deprecation warnings. Non-blocking does not wait for keypress so
* stdin state is not disturbed before the TUI initialises its own raw-mode
* handler. The warnings remain visible in the scrollback above the TUI.
*/
export async function showDeprecationWarnings(warnings: string[]): Promise<void> {
if (warnings.length === 0) return;
@ -264,17 +266,6 @@ export async function showDeprecationWarnings(warnings: string[]): Promise<void>
console.log(chalk.yellow(`\nMove your extensions to the extensions/ directory.`));
console.log(chalk.yellow(`Migration guide: ${MIGRATION_GUIDE_URL}`));
console.log(chalk.yellow(`Documentation: ${EXTENSIONS_DOC_URL}`));
console.log(chalk.dim(`\nPress any key to continue...`));
await new Promise<void>((resolve) => {
process.stdin.setRawMode?.(true);
process.stdin.resume();
process.stdin.once("data", () => {
process.stdin.setRawMode?.(false);
process.stdin.pause();
resolve();
});
});
console.log();
}