module FileUtils

def sh(*cmd, &block)


end
end
puts "pattern not found (status = #{res.exitstatus})"
if !ok
sh %{grep pattern file} do |ok, res|
# check exit status after command runs

sh 'ls', 'file with spaces'

sh 'ls -ltr'

Examples:

Without a block a RuntimeError is raised when the command exits non-zero.
OK flag (true on a zero exit status) and a Process::Status object.
If a block is given, upon command completion the block is called with an

; rm # -rf /.
tasks are not vulnerable to users providing an argument like
reserved characters in them. With the multiple argument form your rake
argument form you can easily process files with spaces or other shell
user input for both usability and security reasons. With the multiple
It is recommended you use the multiple argument form over interpolating

Kernel::system).
is run directly (without the shell, same semantics as Kernel::exec and
Run the system command +cmd+. If multiple arguments are given the command
def sh(*cmd, &block)
  options = (Hash === cmd.last) ? cmd.pop : {}
  shell_runner = block_given? ? block : create_shell_runner(cmd)
  set_verbose_option(options)
  verbose = options.delete :verbose
  noop    = options.delete(:noop) || Rake::FileUtilsExt.nowrite_flag
  Rake.rake_output_message sh_show_command cmd if verbose
  unless noop
    res = (Hash === cmd.last) ? system(*cmd) : system(*cmd, options)
    status = $?
    status = Rake::PseudoStatus.new(1) if !res && status.nil?
    shell_runner.call(res, status)
  end
end