Skip to content

Commit

Permalink
Unlink Tempfiles after use in SpawnProcess
Browse files Browse the repository at this point in the history
On Windows, the finalizer for Tempfile will raise an error if
Errno::ENOACCES is raised when removing the file. However, if this
happens when #unlink is called, the error is caught.

This change calls #unlink on the Tempfiles that are used to store the
output of spawned processes. This means the finalizer will not need to
unlink the file, so any Errno::ENOACCES errors during unlinking will be
caught.

The raised errors did not make any specs fail, but they did appear in
the rspec output.
  • Loading branch information
mvz committed Apr 1, 2024
1 parent d10f8fb commit ab257e3
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions lib/aruba/processes/spawn_process.rb
Original file line number Diff line number Diff line change
Expand Up @@ -360,6 +360,7 @@ def read_temporary_output_file(file)
file.rewind
data = file.read
file.close
file.unlink

data.force_encoding("UTF-8")
end
Expand Down

0 comments on commit ab257e3

Please sign in to comment.