From 833a011b81cc6d035eeffa43d79bf47d2d7dd47e Mon Sep 17 00:00:00 2001 From: Matijs van Zuijlen Date: Mon, 1 Apr 2024 21:27:34 +0200 Subject: [PATCH 1/2] 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 From e35a0fa535e16b0c21be9f301ece52c1e60d45f9 Mon Sep 17 00:00:00 2001 From: Matijs van Zuijlen Date: Mon, 1 Apr 2024 22:09:12 +0200 Subject: [PATCH 2/2] Regenerate RuboCop to-do file --- .rubocop_todo.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 8e89e105d..203e79586 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -17,7 +17,7 @@ Metrics/BlockLength: # Configuration parameters: CountComments, CountAsOne. Metrics/ClassLength: - Max: 145 + Max: 146 # Configuration parameters: AllowedMethods, AllowedPatterns. Metrics/CyclomaticComplexity: @@ -101,8 +101,6 @@ RSpec/InstanceVariable: - 'spec/aruba/api/filesystem_spec.rb' - 'spec/aruba/api_spec.rb' - 'spec/aruba/event_bus_spec.rb' - - 'spec/aruba/matchers/command/have_output_size_spec.rb' - - 'spec/aruba/matchers/command_spec.rb' - 'spec/aruba/matchers/directory_spec.rb' - 'spec/aruba/matchers/file_spec.rb' - 'spec/aruba/matchers/path_spec.rb'