lib/core_ext/kernel.rb
# This impementation of system aborts on failure
# and does not swallow ^C to allow for graceful exit
This impementation of system aborts on failure
and does not swallow ^C to allow for graceful exit
This impementation of system aborts on failure and does not swallow ^C to allow for graceful exit
def safe_system(cmd, *args)
    args.map!(&:to_s)
    Process.waitpid(fork do
      yield if block_given?
      exec cmd, *args rescue nil
      exit! 1
    end)
    unless $?.success?
      args.map! { |arg| arg.gsub(' ', "\\ ")}
      error!("Running #{cmd} #{args.join(' ')}: exit #{$?.exitstatus}")
    end
  end
def safe_system ( cmd , * args ) args . map! ( & :to_s ) Process . waitpid ( fork do yield if block_given? exec cmd , * args rescue nil exit! 1 end ) unless $? . success? args . map! { | arg | arg . gsub ( ' ' , "\\ " ) } error! ( "Running #{cmd} #{args.join(' ')}: exit #{$?.exitstatus}" ) end end
This impementation of system aborts on failure
and does not swallow ^C to allow for graceful exit
This impementation of system aborts on failure and does not swallow ^C to allow for graceful exit
# Only raises SystemCallError on execution error and # Errno::ENOENT (typically) if the command can't be found
cmd
args