joeyespo / grip

Preview GitHub README.md files locally before committing them.
MIT License
6.46k stars 424 forks source link

fix #211: EADDRINUSE #216

Closed davisjam closed 7 years ago

davisjam commented 7 years ago

If a grip server is already running on the requested port, fail cleanly instead of dumping the call stack.

davisjam commented 7 years ago

@joeyespo I'm not 100% sure I picked a portable exception. Will this error manifest as a socket.error on non-Linuces? I tested on Ubuntu.

+ except socket.error as ex:

jwilk commented 7 years ago

It's socket.errno with .errno == errno.EADDRINUSE for Python 2.7 on Windows 7 at least. I think it should be fine everywhere else, too.

joeyespo commented 7 years ago

This looks good! Thanks for the fix 😃