fix(cli): wait for process exit before restarting gateway on Windows (openclaw#27913) thanks @tda1017

Verified:
- pnpm vitest src/cli/update-cli/restart-helper.test.ts
- pnpm check
- pnpm build

Co-authored-by: tda1017 <95275462+tda1017@users.noreply.github.com>
Co-authored-by: Tak Hoffman <781889+Takhoffman@users.noreply.github.com>
This commit is contained in:
tda
2026-03-02 22:31:03 +08:00
committed by GitHub
parent cd18472405
commit d145518f94
3 changed files with 81 additions and 4 deletions

View File

@@ -818,11 +818,15 @@ export async function updateCommand(opts: UpdateCommandOptions): Promise<void> {
let restartScriptPath: string | null = null;
let refreshGatewayServiceEnv = false;
const gatewayPort = resolveGatewayPort(
configSnapshot.valid ? configSnapshot.config : undefined,
process.env,
);
if (shouldRestart) {
try {
const loaded = await resolveGatewayService().isLoaded({ env: process.env });
if (loaded) {
restartScriptPath = await prepareRestartScript(process.env);
restartScriptPath = await prepareRestartScript(process.env, gatewayPort);
refreshGatewayServiceEnv = true;
}
} catch {
@@ -903,7 +907,7 @@ export async function updateCommand(opts: UpdateCommandOptions): Promise<void> {
result,
opts,
refreshServiceEnv: refreshGatewayServiceEnv,
gatewayPort: resolveGatewayPort(configSnapshot.valid ? configSnapshot.config : undefined),
gatewayPort,
restartScriptPath,
});