You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It appears that the polyfill for Node.js's server does not correctly emit an "error" event when asked to listen on a port that is not available. To reproduce the problem, try running the following script in two separate Deno instances.
importhttpfrom"node:http";constserver=http.createServer();server.once("error",function(error){console.log("Failed to listen",error);});server.listen(9000,()=>console.log("listening"));
The first instance logs "listening", which is correct. But the second instance crashes, instead of logging "Failed to listen" to stderr.
Reproduced in Deno v1.36.1 on MacOS.
I believe the problem is that there is no try...catch around the call to Deno.listen, which throws if the port is not available:
It appears that the polyfill for Node.js's server does not correctly emit an "error" event when asked to listen on a port that is not available. To reproduce the problem, try running the following script in two separate Deno instances.
The first instance logs "listening", which is correct. But the second instance crashes, instead of logging "Failed to listen" to stderr.
Reproduced in Deno v1.36.1 on MacOS.
I believe the problem is that there is no try...catch around the call to
Deno.listen
, which throws if the port is not available:deno/ext/node/polyfills/http.ts
Line 1580 in 1b0e394
deno/ext/node/polyfills/http.ts
Line 1613 in 1b0e394
deno/ext/http/00_serve.js
Line 669 in 1b0e394
The text was updated successfully, but these errors were encountered: