mirror of
https://github.com/garrytan/gstack.git
synced 2026-10-31 14:06:50 +01:00
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:
1 parent
605f49d3d5
commit
4b983a0569
1 file changed
+5
-1
@@ -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 });
|
||||
|
||||
Reference in new issue
Block a user