mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-04 16:00:24 +00:00
perf: reduce status json startup memory
This commit is contained in:
@@ -1,12 +1,10 @@
|
||||
import process from "node:process";
|
||||
import { fileURLToPath } from "node:url";
|
||||
import { loadDotEnv } from "../infra/dotenv.js";
|
||||
import { normalizeEnv } from "../infra/env.js";
|
||||
import { formatUncaughtError } from "../infra/errors.js";
|
||||
import { isMainModule } from "../infra/is-main.js";
|
||||
import { ensureOpenClawCliOnPath } from "../infra/path-env.js";
|
||||
import { assertSupportedRuntime } from "../infra/runtime-guard.js";
|
||||
import { installUnhandledRejectionHandler } from "../infra/unhandled-rejections.js";
|
||||
import { enableConsoleCapture } from "../logging.js";
|
||||
import {
|
||||
getCommandPathWithRootOptions,
|
||||
@@ -14,6 +12,7 @@ import {
|
||||
hasHelpOrVersion,
|
||||
isRootHelpInvocation,
|
||||
} from "./argv.js";
|
||||
import { loadCliDotEnv } from "./dotenv.js";
|
||||
import { applyCliProfileEnv, parseCliProfileArgs } from "./profile.js";
|
||||
import { tryRouteCli } from "./route.js";
|
||||
import { normalizeWindowsArgv } from "./windows-argv.js";
|
||||
@@ -91,7 +90,7 @@ export async function runCli(argv: string[] = process.argv) {
|
||||
}
|
||||
normalizedArgv = parsedProfile.argv;
|
||||
|
||||
loadDotEnv({ quiet: true });
|
||||
loadCliDotEnv({ quiet: true });
|
||||
normalizeEnv();
|
||||
if (shouldEnsureCliPath(normalizedArgv)) {
|
||||
ensureOpenClawCliOnPath();
|
||||
@@ -116,6 +115,7 @@ export async function runCli(argv: string[] = process.argv) {
|
||||
|
||||
const { buildProgram } = await import("./program.js");
|
||||
const program = buildProgram();
|
||||
const { installUnhandledRejectionHandler } = await import("../infra/unhandled-rejections.js");
|
||||
|
||||
// Global error handlers to prevent silent crashes from unhandled rejections/exceptions.
|
||||
// These log the error and exit gracefully instead of crashing without trace.
|
||||
|
||||
Reference in New Issue
Block a user