
























@@ -1,4 +1,5 @@
11import { describe, expect, it } from "vitest";
2+import { formatCliCommand } from "../cli/command-format.js";
23import {
34buildPortHints,
45classifyPortListener,
@@ -9,6 +10,10 @@ import {
910isSingleExpectedGatewayListener,
1011} from "./ports-format.js";
111213+const gatewayAlreadyRunningHint = `Gateway already running locally. Stop it (${formatCliCommand("openclaw gateway stop")}) or use a different port.`;
14+const multipleListenersHint =
15+"Multiple listeners detected; ensure only one gateway/tunnel per port unless intentionally running isolated profiles.";
16+1217describe("ports-format", () => {
1318it.each([
1419[{ commandLine: "ssh -N -L 18789:127.0.0.1:18789 user@host" }, "ssh"],
@@ -30,10 +35,10 @@ describe("ports-format", () => {
303518789,
3136),
3237).toEqual([
33-expect.stringContaining("Gateway already running locally."),
38+gatewayAlreadyRunningHint,
3439"SSH tunnel already bound to this port. Close the tunnel or use a different local port in -L.",
3540"Another process is listening on this port.",
36-expect.stringContaining("Multiple listeners detected"),
41+multipleListenersHint,
3742]);
3843expect(buildPortHints([], 18789)).toStrictEqual([]);
3944});
@@ -72,10 +77,7 @@ describe("ports-format", () => {
7277],
737818789,
7479),
75-).toEqual([
76-expect.stringContaining("Gateway already running locally."),
77-expect.stringContaining("Multiple listeners detected"),
78-]);
80+).toEqual([gatewayAlreadyRunningHint, multipleListenersHint]);
7981});
80828183it.each([
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。