Skip to content

Commit

Permalink
issue #487: extra begin/end for older Ruby versions
Browse files Browse the repository at this point in the history
  • Loading branch information
ColinDKelley committed Oct 30, 2020
1 parent 84c0b6b commit c23a8e2
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
10 changes: 6 additions & 4 deletions lib/listen/thread.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,12 @@ def new(name)

caller_stack = caller
::Thread.new do
yield
rescue Exception => ex
_log_exception(ex, thread_name, caller_stack)
nil
begin
yield
rescue Exception => ex
_log_exception(ex, thread_name, caller_stack)
nil
end
end.tap do |thread|
thread.name = thread_name
end
Expand Down
10 changes: 6 additions & 4 deletions spec/lib/listen/thread_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,14 @@
let(:block) do
-> do
begin
raise ArgumentError, 'boom!'
begin
raise ArgumentError, 'boom!'
rescue
raise 'nested inner'
end
rescue
raise 'nested inner'
raise 'nested outer'
end
rescue
raise 'nested outer'
end
end

Expand Down

0 comments on commit c23a8e2

Please sign in to comment.