Lightweight coding agent that runs in your terminal
Rust
fix: check workdir before spawn (#221)
LouisLvaf69e793e705
diff --git a/codex-cli/src/utils/agent/handle-exec-command.ts b/codex-cli/src/utils/agent/handle-exec-command.tsindex 41b7abbcd4..84dbbc9ced 100644--- a/codex-cli/src/utils/agent/handle-exec-command.ts+++ b/codex-cli/src/utils/agent/handle-exec-command.ts@@ -204,11 +204,20 @@ async function execCommand(runInSandbox: boolean,abortSignal?: AbortSignal,): Promise<ExecCommandSummary> {+ let { workdir } = execInput;+ if (workdir) {+ try {+ await access(workdir);+ } catch (e) {+ log(`EXEC workdir=${workdir} not found, use process.cwd() instead`);+ workdir = process.cwd();+ }+ }if (isLoggingEnabled()) {if (applyPatchCommand != null) {log("EXEC running apply_patch command");} else {- const { cmd, workdir, timeoutInMillis } = execInput;+ const { cmd, timeoutInMillis } = execInput;// Seconds are a bit easier to read in log messages and most timeouts// are specified as multiples of 1000, anyway.const timeout =