Файли
openidea/src/features/run/serverPort.ts
T
l0ng-ai cfd2970531 feat(services): List run configurations in the Services tool window (#160)
The Services tool window lists run configurations next to Docker. Spring Boot configurations appear by default; other types (Application, npm, Maven, Gradle, …) are added with + › Run Configuration Type and removed with Remove from Services, remembered per project. Nodes group by type and show running / stopped, with Run / Rerun, Debug, Stop, Show in Run Tool Window and Edit Configuration… in the toolbar and context menu; the detail pane shows the same console as the Run tool window. Running Spring Boot apps show the HTTP port read from the embedded server's "started on port" line.

Rerun now waits for the old process to exit before starting the new one, so a restarted server no longer fails with its port already in use, and a process stopped by the user no longer raises an exit-code notification.

Closes #150

Claude-Session: https://claude.ai/code/session_01Dq6jQQn8ZhRfkkyj3PRutA
2026-10-29 01:06:32 +08:00

16 рядки
642 B
TypeScript

/**
* 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;
}