fix(install): handle 'undefined' string from openclaw config get

- getJson now treats 'undefined' string as missing value
- Add try-catch to JSON.parse for robustness
This commit is contained in:
zhi
2026-03-03 17:57:34 +00:00
parent 91cd402627
commit be8fe835d0

View File

@@ -67,8 +67,12 @@ function runOpenclaw(args, { allowFail = false } = {}) {
function getJson(pathKey) {
const out = runOpenclaw(["config", "get", pathKey, "--json"], { allowFail: true });
if (out == null || out === "") return undefined;
if (out == null || out === "" || out === "undefined") return undefined;
try {
return JSON.parse(out);
} catch {
return undefined;
}
}
function setJson(pathKey, value) {