Skip to content

Commit cba565f

Browse files
authored
Merge pull request #202 from igaiga/fix_sh_hash_option_problem
Change FileUtils#sh to adopt with hash style option.
2 parents 252ad9e + 9be0171 commit cba565f

2 files changed

Lines changed: 10 additions & 1 deletion

File tree

lib/rake/file_utils.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ def sh(*cmd, &block)
5050
Rake.rake_output_message sh_show_command cmd if verbose
5151

5252
unless noop
53-
res = system(*cmd, options)
53+
res = (Hash === cmd.last) ? system(*cmd) : system(*cmd, options)
5454
status = $?
5555
status = Rake::PseudoStatus.new(1) if !res && status.nil?
5656
shell_runner.call(res, status)

test/test_rake_file_utils.rb

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,15 @@ def test_sh_with_spawn_options
180180
assert_equal "echocommand.rb\n", r.read
181181
end
182182

183+
def test_sh_with_hash_option
184+
skip "JRuby does not support spawn options" if jruby?
185+
check_expansion
186+
187+
verbose(false) {
188+
sh "#{RUBY} check_expansion.rb", {chdir: "."}, { verbose: false }
189+
}
190+
end
191+
183192
def test_sh_failure
184193
shellcommand
185194

0 commit comments

Comments
 (0)