Skip to content

Commit fc30464

Browse files
authored
Merge pull request #708 from technicalpickles/timeout-around-verify-server-version
Add timeout when connecting to server
2 parents 378e0ce + fc6ef49 commit fc30464

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

lib/spring/client/run.rb

+10-1
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,16 @@ def stop_server
114114
end
115115

116116
def verify_server_version
117-
server_version = server.gets.chomp
117+
unless IO.select([server], [], [], CONNECT_TIMEOUT)
118+
raise "Error connecting to Spring server"
119+
end
120+
121+
line = server.gets
122+
unless line
123+
raise "Error connecting to Spring server"
124+
end
125+
126+
server_version = line.chomp
118127
if server_version != env.version
119128
$stderr.puts "There is a version mismatch between the Spring client " \
120129
"(#{env.version}) and the server (#{server_version})."

0 commit comments

Comments
 (0)