Skip to content

Commit

Permalink
Merge pull request #708 from technicalpickles/timeout-around-verify-s…
Browse files Browse the repository at this point in the history
…erver-version

Add timeout when connecting to server
  • Loading branch information
byroot committed Dec 7, 2023
2 parents 378e0ce + fc6ef49 commit fc30464
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion lib/spring/client/run.rb
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,16 @@ def stop_server
end

def verify_server_version
server_version = server.gets.chomp
unless IO.select([server], [], [], CONNECT_TIMEOUT)
raise "Error connecting to Spring server"
end

line = server.gets
unless line
raise "Error connecting to Spring server"
end

server_version = line.chomp
if server_version != env.version
$stderr.puts "There is a version mismatch between the Spring client " \
"(#{env.version}) and the server (#{server_version})."
Expand Down

0 comments on commit fc30464

Please sign in to comment.