module Rexe::Helpers

Public Instance Methods

try() { || ... } click to toggle source

Try executing code. If error raised, print message (but not stack trace) & exit -1.

# File exe/rexe, line 26
def try
  begin
    yield
  rescue Exception => e
    unless e.class == SystemExit
      $stderr.puts("rexe: #{e}")
      $stderr.puts("Use the -h option to get help.")
      exit(-1)
    end
  end
end