fix: correct openclaw config set command syntax

- Move --json flag to correct position (before value)
- Add explicit encoding and error handling
This commit is contained in:
zhi
2026-03-05 12:37:29 +00:00
parent bb194ef978
commit 232b772a6b

View File

@@ -95,14 +95,13 @@ function getOpenclawConfig(pathKey, defaultValue = undefined) {
}
function setOpenclawConfig(pathKey, value) {
execSync(`openclaw config set ${pathKey} '${JSON.stringify(value)}' --json`, {
cwd: __dirname
});
const cmd = `openclaw config set ${pathKey} --json '${JSON.stringify(value)}'`;
execSync(cmd, { cwd: __dirname, encoding: 'utf8' });
}
function unsetOpenclawConfig(pathKey) {
try {
execSync(`openclaw config unset ${pathKey}`, { cwd: __dirname });
execSync(`openclaw config unset ${pathKey}`, { cwd: __dirname, encoding: 'utf8' });
} catch {
// Ignore errors
}