Skip to content

Commit

Permalink
Merge pull request #751 from koic/prevent_net_readtimeout_error_in_ru…
Browse files Browse the repository at this point in the history
…by_2_6

Prevent `Net/ReadTimeout` error in Ruby 2.6
  • Loading branch information
bblimke committed Apr 29, 2018
2 parents cf37b09 + 1cc36e5 commit 332af13
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions lib/webmock/http_lib_adapters/net_http.rb
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,20 @@ def initialize(io, read_timeout: 60, continue_timeout: nil, debug_output: nil)
end
raise "Unable to create local socket" unless @io
end

if RUBY_VERSION >= '2.6.0'
def rbuf_fill
trace = TracePoint.trace(:line) do |tp|
if tp.binding.local_variable_defined?(:tmp)
tp.binding.local_variable_set(:tmp, nil)
end
end

super

trace.disable
end
end
end

end
Expand Down

0 comments on commit 332af13

Please sign in to comment.