MCPcopy Create free account
hub / github.com/cloudflare/agents / killProcessOnPort

Function killProcessOnPort

packages/agents/src/browser-tests/browser.test.ts:18–35  ·  view source on GitHub ↗
(port: number)

Source from the content-addressed store, hash-verified

16}
17
18function killProcessOnPort(port: number): void {
19 try {
20 const output = execSync(`lsof -ti tcp:${port} 2>/dev/null || true`)
21 .toString()
22 .trim();
23 if (output) {
24 for (const pid of output.split("\n").filter(Boolean)) {
25 try {
26 process.kill(Number(pid), "SIGKILL");
27 } catch {
28 // already dead
29 }
30 }
31 }
32 } catch {
33 // ignore
34 }
35}
36
37function startWrangler(): ChildProcess {
38 const configPath = path.join(__dirname, "wrangler.jsonc");

Callers 1

browser.test.tsFile · 0.70

Calls 1

toStringMethod · 0.80

Tested by

no test coverage detected