You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@whimsical.apache.org by ru...@apache.org on 2017/08/19 15:15:39 UTC
[whimsy] 01/02: handle server already stopped
This is an automated email from the ASF dual-hosted git repository.
rubys pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/whimsy.git
commit f0975a07871d997dbcb690025c8bd0a67d5c6bf6
Author: Sam Ruby <ru...@intertwingly.net>
AuthorDate: Sat Aug 19 11:13:27 2017 -0400
handle server already stopped
---
www/board/agenda/spec/react_server.rb | 18 ++++++++++++------
1 file changed, 12 insertions(+), 6 deletions(-)
diff --git a/www/board/agenda/spec/react_server.rb b/www/board/agenda/spec/react_server.rb
index acec0b4..0da16b4 100644
--- a/www/board/agenda/spec/react_server.rb
+++ b/www/board/agenda/spec/react_server.rb
@@ -55,12 +55,18 @@ class ReactServer
# stop server
def self.stop
return unless @@pid
- http = Net::HTTP.new('localhost', @@port)
- request = Net::HTTP::Post.new('/', {})
- request.body = "response.end('bye'); process.exit(0)"
- response = http.request(request)
- Process.wait(@@pid)
- @@pid = nil
+
+ begin
+ http = Net::HTTP.new('localhost', @@port)
+ request = Net::HTTP::Post.new('/', {})
+ request.body = "response.end('bye'); process.exit(0)"
+ response = http.request(request)
+ rescue Errno::ECONNREFUSED
+ nil
+ ensure
+ Process.wait(@@pid)
+ @@pid = nil
+ end
end
# the server itself
--
To stop receiving notification emails like this one, please contact
"commits@whimsical.apache.org" <co...@whimsical.apache.org>.