From e70fbb204a923ec9ff4dd61af95ebe5d87754eec Mon Sep 17 00:00:00 2001 From: Michael Karlesky Date: Tue, 16 Jul 2024 13:56:24 -0400 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20Made=20ARGV=20capture=20function?= =?UTF-8?q?al?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Because of Thor use in the bootloader, the existing ARGV contents were cleared out when any reference occurred. Now the ARGV is cloned at object instantiation. --- lib/ceedling/system_wrapper.rb | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/ceedling/system_wrapper.rb b/lib/ceedling/system_wrapper.rb index b7e7eea0..4b214ed4 100644 --- a/lib/ceedling/system_wrapper.rb +++ b/lib/ceedling/system_wrapper.rb @@ -26,6 +26,10 @@ def self.time_stopwatch_s return Process.clock_gettime( Process::CLOCK_MONOTONIC, :float_second ) end + def initialize() + @argv = ARGV.clone.freeze + end + # class method so as to be mockable for tests def windows? return SystemWrapper.windows? @@ -43,8 +47,8 @@ def search_paths return ENV['PATH'].split(File::PATH_SEPARATOR) end - def cmdline_args - return ARGV + def get_cmdline + return @argv end def env_set(name, value)