964: def sh(*cmd, &block)
965: options = (Hash === cmd.last) ? cmd.pop : {}
966: unless block_given?
967: show_command = cmd.join(" ")
968: show_command = show_command[0,42] + "..."
969:
970: block = lambda { |ok, status|
971: ok or fail "Command failed with status (#{status.exitstatus}): [#{show_command}]"
972: }
973: end
974: if RakeFileUtils.verbose_flag == :default
975: options[:verbose] = false
976: else
977: options[:verbose] ||= RakeFileUtils.verbose_flag
978: end
979: options[:noop] ||= RakeFileUtils.nowrite_flag
980: rake_check_options options, :noop, :verbose
981: rake_output_message cmd.join(" ") if options[:verbose]
982: unless options[:noop]
983: res = rake_system(*cmd)
984: block.call(res, $?)
985: end
986: end