712: def sh(*cmd, &block)
713: if Hash === cmd.last then
714: options = cmd.pop
715: else
716: options = {}
717: end
718: unless block_given?
719: show_command = cmd.join(" ")
720: show_command = show_command[0,42] + "..." if show_command.length > 45
721: block = lambda { |ok, status|
722: ok or fail "Command failed with status (#{status.exitstatus}): [#{show_command}]"
723: }
724: end
725: fu_check_options options, :noop, :verbose
726: fu_output_message cmd.join(" ") if options[:verbose]
727: unless options[:noop]
728: res = system(*cmd)
729: block.call(res, $?)
730: end
731: end