From e4b4fd5ce8e709c7f81ee2ed7df571a85a1fedeb Mon Sep 17 00:00:00 2001 From: Vincent Koc Date: Sun, 1 Mar 2026 12:22:00 -0800 Subject: [PATCH] Entry: avoid top-level return in version fast-path --- src/entry.ts | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/src/entry.ts b/src/entry.ts index f7c038f73a4..4e243414e2e 100644 --- a/src/entry.ts +++ b/src/entry.ts @@ -149,18 +149,16 @@ if ( process.argv = parsed.argv; } - if (tryHandleRootVersionFastPath(process.argv)) { - return; + if (!tryHandleRootVersionFastPath(process.argv)) { + import("./cli/run-main.js") + .then(({ runCli }) => runCli(process.argv)) + .catch((error) => { + console.error( + "[openclaw] Failed to start CLI:", + error instanceof Error ? (error.stack ?? error.message) : error, + ); + process.exitCode = 1; + }); } - - import("./cli/run-main.js") - .then(({ runCli }) => runCli(process.argv)) - .catch((error) => { - console.error( - "[openclaw] Failed to start CLI:", - error instanceof Error ? (error.stack ?? error.message) : error, - ); - process.exitCode = 1; - }); } }