Permalink
Browse files

Allow start_tunnel to accept a block

  • Loading branch information...
rtyler committed Mar 11, 2013
1 parent 44816f8 commit d4302e617b8c151da1c37e27c2505741ce57d859
Showing with 8 additions and 1 deletion.
  1. +8 −1 lib/passageway/client.rb
View
@@ -54,7 +54,14 @@ def start_tunnel
end
puts " Port #{port} is now publicly accessible from http://#{tunnel['host']} ..."
begin
- sleep 1 while true
+ # If we're using Passageway from within Ruby
+ if block_given?
+ yield
+ else
+ # Otherwise, we're probably calling it on the command line, so
+ # let's just block forever
+ sleep 1 while true
+ end
rescue Interrupt
gateway.close_remote(rp, rh)
exit

0 comments on commit d4302e6

Please sign in to comment.