From e4708d8677882c34ae429baa6234f6507474874a Mon Sep 17 00:00:00 2001 From: sue445 Date: Thu, 9 Jan 2025 23:50:39 +0900 Subject: [PATCH] Support env hash to FileUtils#sh in rake --- gems/rake/13.0/_test/test.rb | 7 +++++++ gems/rake/13.0/rake.rbs | 1 + 2 files changed, 8 insertions(+) diff --git a/gems/rake/13.0/_test/test.rb b/gems/rake/13.0/_test/test.rb index 5a7235ae..8556c7a2 100644 --- a/gems/rake/13.0/_test/test.rb +++ b/gems/rake/13.0/_test/test.rb @@ -21,5 +21,12 @@ def create_task puts "#{name}=#{value}" end end + + task :test_with_sh do + sh "ruby test/unittest_without_env.rb" + + env = { "RACK_ENV" => "test" } + sh env, "ruby test/unittest_with_env.rb" + end end end diff --git a/gems/rake/13.0/rake.rbs b/gems/rake/13.0/rake.rbs index 2c4ecdbf..89e231fb 100644 --- a/gems/rake/13.0/rake.rbs +++ b/gems/rake/13.0/rake.rbs @@ -32,6 +32,7 @@ end module FileUtils def sh: (*String cmd, **untyped options) ?{ (bool, Process::Status) -> void } -> void + | (Hash[String, String] env, *String cmd, **untyped options) ?{ (bool, Process::Status) -> void } -> void def ruby: (*String args, **untyped options) ?{ (bool, Process::Status) -> void } -> void def safe_ln: (*untyped args, **untyped options) -> void def split_all: (String path) -> Array[String]