fix: restore supervisor hint env via helper · openclaw/openclaw@89acdd9
shakkernerd
·
2026-06-24
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -13,6 +13,7 @@ import { approveNodePairing, requestNodePairing } from "../infra/node-pairing.js
|
13 | 13 | import { readRestartSentinel } from "../infra/restart-sentinel.js"; |
14 | 14 | import { SUPERVISOR_HINT_ENV_VARS } from "../infra/supervisor-markers.js"; |
15 | 15 | import { getActiveRuntimePluginRegistry } from "../plugins/active-runtime-registry.js"; |
| 16 | +import { captureEnv, deleteTestEnvValue } from "../test-utils/env.js"; |
16 | 17 | import { |
17 | 18 | GATEWAY_CLIENT_MODES, |
18 | 19 | GATEWAY_CLIENT_NAMES, |
@@ -49,22 +50,15 @@ let ws: WebSocket;
|
49 | 50 | let port: number; |
50 | 51 | |
51 | 52 | async function withoutSupervisorHints<T>(fn: () => Promise<T>): Promise<T> { |
52 | | -const previousEnv = new Map<string, string | undefined>(); |
| 53 | +const envSnapshot = captureEnv([...SUPERVISOR_HINT_ENV_VARS]); |
53 | 54 | for (const key of SUPERVISOR_HINT_ENV_VARS) { |
54 | | -previousEnv.set(key, process.env[key]); |
55 | | -delete process.env[key]; |
| 55 | +deleteTestEnvValue(key); |
56 | 56 | } |
57 | 57 | |
58 | 58 | try { |
59 | 59 | return await fn(); |
60 | 60 | } finally { |
61 | | -for (const [key, value] of previousEnv) { |
62 | | -if (value === undefined) { |
63 | | -delete process.env[key]; |
64 | | -} else { |
65 | | -process.env[key] = value; |
66 | | -} |
67 | | -} |
| 61 | +envSnapshot.restore(); |
68 | 62 | } |
69 | 63 | } |
70 | 64 | |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。