diff --git a/src/main/kube-auth-proxy/kube-auth-proxy.ts b/src/main/kube-auth-proxy/kube-auth-proxy.ts index 414ea334da..fbbfa67a85 100644 --- a/src/main/kube-auth-proxy/kube-auth-proxy.ts +++ b/src/main/kube-auth-proxy/kube-auth-proxy.ts @@ -16,7 +16,10 @@ import { TypedRegEx } from "typed-regex"; import type { Spawn } from "../child-process/spawn.injectable"; import type { Logger } from "../../common/logger"; -const startingServeRegex = TypedRegEx("starting to serve on (?
.+)", "i"); +const startingServeMatcher = "starting to serve on (?
.+)"; +const startingServeRegex = Object.assign(TypedRegEx(startingServeMatcher, "i"), { + rawMatcher: startingServeMatcher, +}); export interface KubeAuthProxyDependencies { readonly proxyBinPath: string; diff --git a/src/main/routes/port-forward/functionality/port-forward.ts b/src/main/routes/port-forward/functionality/port-forward.ts index eafe465972..43d8f9d425 100644 --- a/src/main/routes/port-forward/functionality/port-forward.ts +++ b/src/main/routes/port-forward/functionality/port-forward.ts @@ -9,7 +9,10 @@ import { spawn } from "child_process"; import * as tcpPortUsed from "tcp-port-used"; import { TypedRegEx } from "typed-regex"; -const internalPortRegex = TypedRegEx("^forwarding from (?
.+) ->", "i"); +const internalPortMatcher = "^forwarding from (?
.+) ->"; +const internalPortRegex = Object.assign(TypedRegEx(internalPortMatcher, "i"), { + rawMatcher: internalPortMatcher, +}); export interface PortForwardArgs { clusterId: string; diff --git a/src/main/utils/get-port.ts b/src/main/utils/get-port.ts index 6ce76f6795..b0d7f5615f 100644 --- a/src/main/utils/get-port.ts +++ b/src/main/utils/get-port.ts @@ -20,6 +20,7 @@ interface GetPortArgs { }; raw?: RegExpExecArray; }; + rawMatcher: string; }; /** * Called when the port is found @@ -27,7 +28,7 @@ interface GetPortArgs { onFind?: () => void; /** * Timeout for how long to wait for the port. - * Default: 5s + * Default: 15s */ timeout?: number; } @@ -61,7 +62,7 @@ export function getPortFrom(stream: Readable, args: GetPortArgs): Promise { stream.off("data", handler); - logger.warn(`[getPortFrom]: failed to retrieve port via ${args.lineRegex.toString()}: ${logLines}`); + logger.warn(`[getPortFrom]: failed to retrieve port via ${args.lineRegex.rawMatcher}`, logLines); reject(new Error("failed to retrieve port from stream")); }, args.timeout ?? 15000);