storebound 0.8.3: prompts read stdin with rt.readLine (node:readline) instead of Bun-only for await (const line of console), which crashed npx storebound desktop on Node/Windows; node-compat test bans Bun-only stdin iteration; Node prompt smoke, also on the Windows release runner
This commit is contained in:
parent
c3fed8efa2
commit
3a27c78f49
8 changed files with 111 additions and 9 deletions
|
|
@ -1,6 +1,7 @@
|
|||
import type { Args } from './args';
|
||||
import type { Language, Loaded } from './config';
|
||||
import { playCodes } from './config';
|
||||
import * as rt from './rt';
|
||||
|
||||
export interface Ctx { loaded: Loaded; args: Args }
|
||||
|
||||
|
|
@ -42,8 +43,8 @@ export async function confirm(ctx: Ctx, question: string): Promise<boolean> {
|
|||
return declined('not a terminal and no --yes (re-run with --yes to confirm)');
|
||||
}
|
||||
process.stdout.write(`${question} [y/N] `);
|
||||
for await (const line of console) return /^y(es)?$/i.test(line.trim()) || declined('the owner answered no');
|
||||
return declined('no answer (stdin closed)');
|
||||
const line = await rt.readLine();
|
||||
return line !== null && /^y(es)?$/i.test(line.trim()) || declined(line === null ? 'no answer (stdin closed)' : 'the owner answered no');
|
||||
}
|
||||
|
||||
/** Exit code of a command whose confirmation was declined or could not be asked. */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue