Skip to content

The IDE you know, rebuilt in Rust. IntelliJ IDEA–style keymap, tool windows and search-everywhere in a fast native app: editor, code insight, debugger, Git, terminal, database and HTTP clients for 60+ languages.

642 B
Raw Blame
/**
 * The HTTP port of a running Spring Boot application, from the embedded web
 * server's startup line: "Tomcat started on port 8080 (http) with context path '/'",
 * "Netty started on port 8080", "Undertow started on port(s) 8080 (http)",
 * "Jetty started on port(s) 8080 (http/1.1)".
 */
const STARTED = /\b(?:Tomcat|Netty|Undertow|Jetty)\b.*?\bstarted on port(?:\(s\))?:?\s*(\d{1,5})/i;

export function startedPort(line: string): number | null {
  if (!line.includes("tarted on port")) return null;
  const m = STARTED.exec(line);
  if (!m) return null;
  const port = Number(m[1]);
  return port > 0 && port < 65536 ? port : null;
}