test: stabilize runtime context env · openclaw/openclaw@d23977e
shakkernerd
·
2026-06-25
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -28,6 +28,10 @@ function assert(condition: unknown, message: string): asserts condition {
|
28 | 28 | } |
29 | 29 | } |
30 | 30 | |
| 31 | +function setEnvValue(key: string, value: string): void { |
| 32 | +Reflect.set(process.env, key, value); |
| 33 | +} |
| 34 | + |
31 | 35 | async function readJsonl(filePath: string): Promise<TranscriptEntry[]> { |
32 | 36 | const raw = await fs.readFile(filePath, "utf-8"); |
33 | 37 | return raw |
@@ -235,9 +239,10 @@ async function verifyDoctorRepair(root: string) {
|
235 | 239 | |
236 | 240 | async function main() { |
237 | 241 | const root = await fs.mkdtemp(path.join(os.tmpdir(), "openclaw-session-runtime-context-")); |
238 | | -process.env.HOME = root; |
239 | | -process.env.OPENCLAW_STATE_DIR = path.join(root, ".openclaw"); |
240 | | -process.env.OPENCLAW_CONFIG_PATH = path.join(process.env.OPENCLAW_STATE_DIR, "openclaw.json"); |
| 242 | +const stateDir = path.join(root, ".openclaw"); |
| 243 | +setEnvValue("HOME", root); |
| 244 | +setEnvValue("OPENCLAW_STATE_DIR", stateDir); |
| 245 | +setEnvValue("OPENCLAW_CONFIG_PATH", path.join(stateDir, "openclaw.json")); |
241 | 246 | try { |
242 | 247 | await verifyRuntimeContextTranscriptShape(root); |
243 | 248 | await verifyDoctorRepair(root); |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。