E5: watchdog stdin test feeds the wrapper through a redirect

Callers run '_gstack_codex_timeout_wrapper ... codex exec - < file'. Bash keeps
stdin for a backgrounded command inside a pipeline but not behind a
redirect, so the pipe form passed on the old watchdog; the redirect form
reproduces the lost prompt.
This commit is contained in:
garrytan committed 2026-10-03 21:17:03 +00:00
1 parent 605f49d3d5
commit 4b983a0569
1 file changed
+5 -1
+5 -1
View File
@@ -383,7 +383,11 @@ describe('gstack-codex-probe: timeout wrapper + namespace hygiene', () => {
const target = resolved.stdout.toString().trim();
if (target.startsWith('/')) fs.symlinkSync(target, path.join(dir, tool));
}
const r = runProbe({ snippet: `printf 'prompt on stdin' | _gstack_codex_timeout_wrapper 5 cat; echo " rc=$?"`, env: native ? { PATH: dir } : {} });
// A redirect onto the wrapper is how callers feed `codex exec -`; a
// backgrounded command without job control would otherwise read /dev/null.
const input = path.join(dir, 'prompt.txt');
fs.writeFileSync(input, 'prompt on stdin');
const r = runProbe({ snippet: `_gstack_codex_timeout_wrapper 5 cat < "${input}"; echo " rc=$?"`, env: native ? { PATH: dir } : {} });
expect(r.stdout).toBe('prompt on stdin rc=0\n');
} finally {
fs.rmSync(dir, { recursive: true, force: true });