Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
A
Tempfile
works by defining a "finalizer" this is code that gets run when the object is cleaned up via GC. Here's a link:https://github.com/ruby/ruby/blob/935d0b3d05dfc8b30bba505792129bf0e33ebe3b/lib/tempfile.rb#L132
As long as another object has a reference to a Tempfile then it will not be deleted from disk. In this scenario we're passing it to a
Pathname
object and it does not retain a reference to the passed in argument. You can reproduce this bug/behavior outside of Rundoc:This generates:
This PR fixes the behavior by forcing a reference to the Tempfile object in the top level ProcessSpawn instance instead of expecting the Pathname
@log
instance variable to hold its reference.