fix: unblock claude-cli live runs
This commit is contained in:
@@ -59,13 +59,14 @@ export async function runCommandWithTimeout(
|
||||
? { timeoutMs: optionsOrTimeout }
|
||||
: optionsOrTimeout;
|
||||
const { timeoutMs, cwd, input, env } = options;
|
||||
const hasInput = input !== undefined;
|
||||
|
||||
// Spawn with inherited stdin (TTY) so tools like `pi` stay interactive when needed.
|
||||
return await new Promise((resolve, reject) => {
|
||||
const child = spawn(argv[0], argv.slice(1), {
|
||||
stdio: [input ? "pipe" : "inherit", "pipe", "pipe"],
|
||||
stdio: [hasInput ? "pipe" : "inherit", "pipe", "pipe"],
|
||||
cwd,
|
||||
env: env ? { ...process.env, ...env } : process.env,
|
||||
env: env ?? process.env,
|
||||
});
|
||||
let stdout = "";
|
||||
let stderr = "";
|
||||
@@ -74,8 +75,8 @@ export async function runCommandWithTimeout(
|
||||
child.kill("SIGKILL");
|
||||
}, timeoutMs);
|
||||
|
||||
if (input && child.stdin) {
|
||||
child.stdin.write(input);
|
||||
if (hasInput && child.stdin) {
|
||||
child.stdin.write(input ?? "");
|
||||
child.stdin.end();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user