Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

'Ngrok::Tunnel.running?' could be determined on-the-fly #8

Open
lukehorvat opened this issue Oct 12, 2015 · 1 comment
Open

'Ngrok::Tunnel.running?' could be determined on-the-fly #8

lukehorvat opened this issue Oct 12, 2015 · 1 comment

Comments

@lukehorvat
Copy link

Hi. I've built a gem for localtunnel (an ngrok alternative), using your gem as inspiration. So thanks!

Looking at your code, one thing I noticed is that there is a potential problem with the Ngrok::Tunnel.running? method. If something else (other than Ngrok::Tunnel.stop) kills the tunnel's process, Ngrok::Tunnel.running? will continue to return true, because the @status attribute is stale. To fix this, Ngrok::Tunnel.running? could check whether the process is actually alive via Process.waitpid. Here's an example from my gem: link.

Also, I think it may be a good idea for Ngrok::Tunnel.stop? to wait until the process is completely destroyed after calling Process.kill, since it can take a few moments. Again, here's an example from my gem: link.

@bogdanovich
Copy link
Owner

Thanks for you suggestions.
Pull requests are welcome!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants