Skip to content

Commit

Permalink
Make timeout_sec a constant
Browse files Browse the repository at this point in the history
  • Loading branch information
ono-max authored and ko1 committed Jul 6, 2021
1 parent 53429ef commit da22e7c
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions test/support/utils.rb
Original file line number Diff line number Diff line change
Expand Up @@ -94,17 +94,17 @@ def setup_remote_debuggee(cmd)
@remote_r.read(1) # wait for the remote server to boot up
end

TIMEOUT_SEC = (ENV['RUBY_DEBUG_TIMEOUT_SEC'] || 10).to_i

def run_test_scenario(cmd, repl_prompt)
@queue = Queue.new
@scenario.call

timeout_sec = (ENV['RUBY_DEBUG_TIMEOUT_SEC'] || 10).to_i

PTY.spawn(cmd) do |read, write, pid|
@backlog = []
@last_backlog = []
begin
Timeout.timeout(timeout_sec) do
Timeout.timeout(TIMEOUT_SEC) do
while (line = read.gets)
debug_print line
case line.chomp
Expand Down Expand Up @@ -141,7 +141,7 @@ def run_test_scenario(cmd, repl_prompt)
# https://github.com/ruby/ruby/blob/master/ext/pty/pty.c#L729-L736
assert_empty_queue(exception: e)
rescue Timeout::Error => e
assert false, create_message("TIMEOUT ERROR (#{timeout_sec} sec)")
assert false, create_message("TIMEOUT ERROR (#{TIMEOUT_SEC} sec)")
ensure
# kill remote debuggee
if defined?(@remote_debuggee_pid) && @remote_debuggee_pid
Expand Down

0 comments on commit da22e7c

Please sign in to comment.