mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 15:30:47 +00:00
Refactor file access to use fs-safe primitives (#78255)
* refactor: use fs-safe primitives across file access * fix: preserve invalid managed npm manifests * fix: keep fs seams for startup metadata
This commit is contained in:
committed by
GitHub
parent
0d73f174a9
commit
b85b1c68d1
@@ -1,6 +1,6 @@
|
||||
import fs from "node:fs";
|
||||
import { createRequire } from "node:module";
|
||||
import path from "node:path";
|
||||
import { loadJsonFile } from "openclaw/plugin-sdk/json-store";
|
||||
import {
|
||||
buildExecRemoteCommand,
|
||||
createSshSandboxSessionFromConfigText,
|
||||
@@ -37,11 +37,11 @@ function resolveBundledOpenShellCommand(): string | null {
|
||||
}
|
||||
try {
|
||||
const packageJsonPath = require.resolve("openshell/package.json");
|
||||
const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, "utf8")) as {
|
||||
const packageJson = loadJsonFile<{
|
||||
bin?: string | Record<string, string>;
|
||||
};
|
||||
}>(packageJsonPath);
|
||||
const relativeBin =
|
||||
typeof packageJson.bin === "string" ? packageJson.bin : packageJson.bin?.openshell;
|
||||
typeof packageJson?.bin === "string" ? packageJson.bin : packageJson?.bin?.openshell;
|
||||
cachedBundledOpenShellCommand = relativeBin
|
||||
? path.resolve(path.dirname(packageJsonPath), relativeBin)
|
||||
: null;
|
||||
|
||||
Reference in New Issue
Block a user