Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Unreleased

- Handle potential Errno::EBADF raised by `IO#reopen` in `Pitchfork::Info.close_all_ios!`.

# 0.18.0

- Fix a regression introduced in `0.17.0` causing `before_worker_exit` to often not be called.
Expand Down
5 changes: 4 additions & 1 deletion lib/pitchfork/info.rb
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,10 @@ def close_all_ios!
if io.is_a?(TCPSocket)
# If we inherited a TCP Socket, calling #close directly could send FIN or RST.
# So we first reopen /dev/null to avoid that.
io.reopen(File::NULL)
begin
io.reopen(File::NULL)
rescue Errno::EBADF
end
end
begin
io.close
Expand Down