fix(bootstrap): create workspace dir before setting openclaw config
On fresh Linux installs (e.g. running as root), `openclaw config set agents.defaults.workspace` fails because the target directory doesn't exist yet — some OpenClaw builds validate the path on disk before accepting the value. Create the directory eagerly with mkdirSync before the config set call. Also surface the exit code in runOpenClawOrThrow errors when stderr is empty, so silent failures are easier to diagnose. Fixes #101
This commit is contained in:
parent
d6ca3b329c
commit
1c92aaf5d7
@ -747,7 +747,10 @@ async function runOpenClawOrThrow(params: {
|
||||
return result;
|
||||
}
|
||||
const detail = firstNonEmptyLine(result.stderr, result.stdout);
|
||||
throw new Error(detail ? `${params.errorMessage}\n${detail}` : params.errorMessage);
|
||||
const parts = [params.errorMessage];
|
||||
if (detail) parts.push(detail);
|
||||
else if (result.code != null) parts.push(`(exit code ${result.code})`);
|
||||
throw new Error(parts.join("\n"));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -770,7 +773,10 @@ async function runOpenClawInteractiveOrThrow(params: {
|
||||
return result;
|
||||
}
|
||||
const detail = firstNonEmptyLine(result.stderr, result.stdout);
|
||||
throw new Error(detail ? `${params.errorMessage}\n${detail}` : params.errorMessage);
|
||||
const parts = [params.errorMessage];
|
||||
if (detail) parts.push(detail);
|
||||
else if (result.code != null) parts.push(`(exit code ${result.code})`);
|
||||
throw new Error(parts.join("\n"));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -2223,6 +2229,9 @@ export async function bootstrapCommand(
|
||||
|
||||
// Pin OpenClaw to the managed default workspace before onboarding so bootstrap
|
||||
// never drifts into creating/using legacy workspace-* paths.
|
||||
// The directory must exist before `openclaw config set` — some OpenClaw builds
|
||||
// validate the workspace path on disk before accepting the value.
|
||||
mkdirSync(workspaceDir, { recursive: true });
|
||||
preCloudSpinner?.message("Configuring default workspace…");
|
||||
await ensureDefaultWorkspacePath(openclawCommand, profile, workspaceDir);
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user