From ab257e366e0c70598aa278592f32320f501cedf2 Mon Sep 17 00:00:00 2001 From: Matijs van Zuijlen Date: Mon, 1 Apr 2024 21:27:34 +0200 Subject: [PATCH] Unlink Tempfiles after use in SpawnProcess 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. --- lib/aruba/processes/spawn_process.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/aruba/processes/spawn_process.rb b/lib/aruba/processes/spawn_process.rb index db807f481..a2d184fd8 100644 --- a/lib/aruba/processes/spawn_process.rb +++ b/lib/aruba/processes/spawn_process.rb @@ -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