fix: check workdir before spawn (#221)
The workdir used to spawn a agent command is provide by the agent tool, we need to ensure its existence and fallback to process.cwd when not. fix #212
This commit is contained in:
parent
4926cab476
commit
af69e793e7
1 changed files with 10 additions and 1 deletions
|
|
@ -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 =
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue