552: def sh(*cmd, &block)
553: if Hash === cmd.last then
554: options = cmd.pop
555: else
556: options = {}
557: end
558: unless block_given?
559: show_command = cmd.join(" ")
560: show_command = show_command[0,42] + "..." if show_command.length > 45
561: block = lambda { |ok, status|
562: ok or fail "Command failed with status (#{status.exitstatus}): [#{show_command}]"
563: }
564: end
565: fu_check_options options, :noop, :verbose
566: fu_output_message cmd.join(" ") if options[:verbose]
567: unless options[:noop]
568: res = system(*cmd)
569: block.call(res, $?)
570: end
571: end