fix: keep gateway command in foreground

This commit is contained in:
2026-09-20 15:05:31 +08:00
parent 2cb22ac5e5
commit 42cbf8e460
-13
View File
@@ -26,19 +26,6 @@ const env = { ...process.env, ...rootEnv, ...gatewayEnv };
if (!env.LISTEN_ADDR) env.LISTEN_ADDR = "127.0.0.1:28187";
if (!env.GATEWAY_TOKEN) env.GATEWAY_TOKEN = "dev-creatorhub-gateway-token";
const port = env.LISTEN_ADDR.match(/:(\d+)$/)?.[1] ?? "28187";
try {
const response = await fetch(`http://127.0.0.1:${port}/healthz`, {
signal: AbortSignal.timeout(1000),
});
if (response.status === 204 || response.ok) {
console.log(`[dev-gateway] 已有 gateway 运行于 127.0.0.1:${port},直接复用。`);
process.exit(0);
}
} catch {
// The port is available or belongs to a different service; let the gateway report that clearly.
}
const gateway = spawn("python3", ["-m", "browser_gateway.server.http"], {
cwd: root,
env,