Skip to content

Commit

Permalink
Simplify shelling out helpers in remote debugging tests
Browse files Browse the repository at this point in the history
  • Loading branch information
deivid-rodriguez committed Jan 24, 2020
1 parent 87d9a7e commit ab9bf88
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions test/support/remote_debugging_tests.rb
Original file line number Diff line number Diff line change
Expand Up @@ -56,25 +56,22 @@ def write_program(code)
end

def remote_debug_and_connect(*commands)
remote_debug(*commands) do |wait_th|
remote_debug(*commands) do
launch_client

wait_for_client_startup

wait_th.value
end
end

def remote_debug_connect_and_interrupt(*commands)
remote_debug(*commands) do |wait_th, err_th|
remote_debug(*commands) do |err_th|
th = Thread.new { launch_client }

wait_for_client_startup

th.kill

err_th.join
wait_th.value
end
end

Expand All @@ -84,7 +81,9 @@ def remote_debug(*commands)
Open3.popen3(shell_out_env, "ruby #{example_path}") do |_i, _o, e, wait_thr|
err_thr = Thread.new { print e.read }

yield(wait_thr, err_thr)
yield(err_thr)

wait_thr.value
end
end

Expand Down

0 comments on commit ab9bf88

Please sign in to comment.