()
| 497 | export function getAnyFreePort(preferred: number): Promise<number> { |
| 498 | return new Promise(async (resolve, reject) => { |
| 499 | function findFreePorts() { |
| 500 | const portFinderOpts = { min: 60000, max: 62000, retrieve: 1, consecutive: false }; |
| 501 | TcpPortScanner.findFreePorts(portFinderOpts, GDBServer.LOCALHOST).then((ports) => { |
| 502 | resolve(ports[0]); |
| 503 | }).catch((e) => { |
| 504 | reject(e); |
| 505 | }); |
| 506 | } |
| 507 | |
| 508 | if (preferred > 0) { |
| 509 | TcpPortScanner.isPortInUseEx(preferred, GDBServer.LOCALHOST, TcpPortScanner.AvoidPorts).then((inuse) => { |
no test coverage detected