xonecas.io
64875
Mc

mini-coder / commit e3b3a1a

fix: wrap select() calls in try/finally to ensure setStdinGated(false)

If select() threw, stdin would stay permanently gated. Wrap both
model and session picker calls in try/finally blocks.

xonecas2026-03-21 e3b3a1aa4d1849d029db42579f522df29aeb8884 parent 01f4abb

2 files changed

src/cli/commands-model.ts+6−2
@@ -150,8 +150,12 @@ async function handleModelSelect(ctx: CommandContext): Promise<void> {
150150 });
151151
152152 setStdinGated(true);
153- const picked = await select({ items, placeholder: "search models..." });
154- setStdinGated(false);
153+ let picked: string | null;
154+ try {
155+ picked = await select({ items, placeholder: "search models..." });
156+ } finally {
157+ setStdinGated(false);
158+ }
155159 if (!picked) return;
156160
157161 ctx.setModel(picked);
src/cli/commands-session.ts+6−2
@@ -43,8 +43,12 @@ export async function handleSessionCommand(
4343 });
4444
4545 setStdinGated(true);
46- const picked = await select({ items, placeholder: "search sessions..." });
47- setStdinGated(false);
46+ let picked: string | null;
47+ try {
48+ picked = await select({ items, placeholder: "search sessions..." });
49+ } finally {
50+ setStdinGated(false);
51+ }
4852 if (!picked) return;
4953
5054 const ok = ctx.switchSession(picked);