mongodb-js / mongodb-prebuilt

Install MongoDB prebuilt package using npm https://npmjs.org/package/mongodb-prebuilt

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Unreliable detection of "address in use" errors

hgcummings opened this issue · comments

I raised PR #8 to address an issue with detecting port conflicts, by removing the use of a regex match on the standard output and using the return code instead.

I notice this got reverted in 195e5cb, because "not every OS returning proper error codes". That's fine, but note that the regex isn't good enough for all platforms either. It checks for the string "errno:48 Address already in use". On Windows, you instead get "errno:10048 Only one usage of each socket address", which obviously doesn't match.

Maybe check the error code first and then fall back to regex? - I'd be happy to implement this if you agree with the approach.

@hgcummings that is why i am getting away from that methodology, and incorporating port finder instead of attempting to start mongod and catching exception from it, so I would wait until "portfinder" change is going to get merged, and then I am going to attempt to remove that block all together

Ah, great, that sounds good. Thanks for explaining.

Closing this issue as unnecessary.