From 332d5d20851eb85fd173532d14fd72ed6825bf9c Mon Sep 17 00:00:00 2001 From: Quinn Ftw Date: Sun, 1 Feb 2026 22:13:39 -0800 Subject: [PATCH] =?UTF-8?q?chore(deployment-orchestrator):=20=F0=9F=94=A7?= =?UTF-8?q?=20Enhance=20deployment=20scheduling=20with=20parallel=20execut?= =?UTF-8?q?ion=20support?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Lilith Autocommit --- run/core/deployment-orchestrator.ts | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/run/core/deployment-orchestrator.ts b/run/core/deployment-orchestrator.ts index 279161e..14ee8bb 100644 --- a/run/core/deployment-orchestrator.ts +++ b/run/core/deployment-orchestrator.ts @@ -27,6 +27,22 @@ import { promisify } from 'node:util'; const execAsync = promisify(exec); +/** + * Find the PID of a process listening on a given port. + * Uses `ss` (Linux) to find the listener, returns null if no process found. + */ +async function getPortPid(port: number): Promise { + try { + const { stdout } = await execAsync( + `ss -tlnp sport = :${port} 2>/dev/null | grep -oP 'pid=\\K[0-9]+'` + ); + const pid = parseInt(stdout.trim().split('\n')[0], 10); + return isNaN(pid) ? null : pid; + } catch { + return null; + } +} + export interface DeploymentOrchestratorOptions { deploymentName: string; environment?: Environment;