fix: exit on EADDRINUSE instead of reusing port — prevents ghost instances with no tunnels
CI / Build & Test (push) Successful in 2m48s
CI / Build & Test (push) Successful in 2m48s
Made-with: Cursor
This commit is contained in:
@@ -85,11 +85,8 @@ function start(port, certsDirOrCA, callback) {
|
||||
const listenPort = port || DEFAULT_PORT;
|
||||
proxyServer.on('error', (err) => {
|
||||
if (err.code === 'EADDRINUSE') {
|
||||
if (process.stderr) process.stderr.write('[https-proxy] port ' + listenPort + ' already in use — previous instance still running, reusing port\n');
|
||||
proxyPort = listenPort;
|
||||
proxyServer.removeAllListeners('error');
|
||||
proxyServer.on('error', () => {});
|
||||
done(null);
|
||||
if (process.stderr) process.stderr.write('[https-proxy] port ' + listenPort + ' already in use — another instance is running, exiting\n');
|
||||
process.exit(0);
|
||||
return;
|
||||
}
|
||||
if (process.stderr) process.stderr.write('[https-proxy] Error: ' + err.message + '\n');
|
||||
|
||||
Reference in New Issue
Block a user