From be8fe835d0bf912630eb77b7ce690756ff2d9049 Mon Sep 17 00:00:00 2001 From: zhi Date: Tue, 3 Mar 2026 17:57:34 +0000 Subject: [PATCH] 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 --- scripts/install-dirigent-openclaw.mjs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/scripts/install-dirigent-openclaw.mjs b/scripts/install-dirigent-openclaw.mjs index 9375e5a..25fade3 100755 --- a/scripts/install-dirigent-openclaw.mjs +++ b/scripts/install-dirigent-openclaw.mjs @@ -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; - return JSON.parse(out); + if (out == null || out === "" || out === "undefined") return undefined; + try { + return JSON.parse(out); + } catch { + return undefined; + } } function setJson(pathKey, value) {