Skip to content

Commit 2865311

Browse files
committed
Changed nomenclature from shell_command to shell_runner.
1 parent 5f52524 commit 2865311

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

lib/rake/file_utils.rb

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ module FileUtils
2929
#
3030
def sh(*cmd, &block)
3131
options = (Hash === cmd.last) ? cmd.pop : {}
32-
block = create_shell_command(cmd) unless block_given?
32+
shell_runner = block_given? ? block : create_shell_runner(cmd)
3333
set_verbose_option(options)
3434
options[:noop] ||= RakeFileUtils.nowrite_flag
3535
rake_check_options options, :noop, :verbose
@@ -38,17 +38,18 @@ def sh(*cmd, &block)
3838
res = rake_system(*cmd)
3939
status = $?
4040
status = PseudoStatus.new(1) if !res && status.nil?
41-
block.call(res, status)
41+
shell_runner.call(res, status)
4242
end
4343
end
4444

45-
def create_shell_command(cmd)
45+
def create_shell_runner(cmd)
4646
show_command = cmd.join(" ")
4747
show_command = show_command[0,42] + "..." unless $trace
4848
block = lambda { |ok, status|
4949
ok or fail "Command failed with status (#{status.exitstatus}): [#{show_command}]"
5050
}
5151
end
52+
private :create_shell_runner
5253

5354
def set_verbose_option(options)
5455
if options[:verbose].nil?

0 commit comments

Comments
 (0)