mirror of
https://github.com/pbakaus/impeccable.git
synced 2026-09-12 14:16:28 +03:00
--wait keeps the table open on a re-roll answer
Live-fire bug from the demo: collecting a re-roll answer deleted the state file, so --update could not find the still-running server and the next hand had nowhere to land. Cleanup is now terminal-only: a re-roll consumes just the answer file and leaves the server state for --update; any other choice cleans up fully as before. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Fable 5
parent
5eb5874170
commit
c96f6d8e84
@@ -107,8 +107,14 @@ if (hasFlag('wait')) {
|
||||
await new Promise((r) => setTimeout(r, 1000));
|
||||
}
|
||||
if (!answered()) { console.log(`WAITING: no answer yet after ${pollSec}s; run --wait --key ${key} again`); process.exit(3); }
|
||||
console.log(`ANSWER: ${fs.readFileSync(answerFile(key), 'utf8').trim()}`);
|
||||
try { fs.rmSync(answerFile(key)); fs.rmSync(stateFile(key)); } catch { /* already cleaned */ }
|
||||
const collected = fs.readFileSync(answerFile(key), 'utf8').trim();
|
||||
console.log(`ANSWER: ${collected}`);
|
||||
// A re-roll keeps the table open: the server stays alive awaiting --update,
|
||||
// so only the answer file is consumed. Terminal choices clean up fully.
|
||||
let isRerollAnswer = false;
|
||||
try { isRerollAnswer = JSON.parse(collected).optionId === 'reroll'; } catch { /* treat as terminal */ }
|
||||
try { fs.rmSync(answerFile(key)); } catch { /* already gone */ }
|
||||
if (!isRerollAnswer) { try { fs.rmSync(stateFile(key)); } catch { /* already gone */ } }
|
||||
process.exit(0);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user