Fix Windows netstat encoding in agent bridge (#894)

This commit is contained in:
ekko
2026-05-21 12:25:38 +08:00
committed by GitHub
parent 284d794260
commit dd3320d1ce
3 changed files with 64 additions and 2 deletions
@@ -245,7 +245,7 @@ function tcpEndpointPort(endpoint: string): number | undefined {
function windowsListeningPidsOnPort(port: number): number[] {
try {
const output = execFileSync('netstat.exe', ['-ano', '-p', 'tcp'], { encoding: 'utf-8', windowsHide: true })
const output = execFileSync('netstat.exe', ['-ano', '-p', 'tcp'], { windowsHide: true }).toString('utf8')
const pids = new Set<number>()
for (const line of output.split(/\r?\n/)) {
const parts = line.trim().split(/\s+/)