# File lib/rake.rb, line 1947
1947:     def standard_exception_handling
1948:       begin
1949:         yield
1950:       rescue SystemExit => ex
1951:         # Exit silently with current status
1952:         exit(ex.status)
1953:       rescue SystemExit, GetoptLong::InvalidOption => ex
1954:         # Exit silently
1955:         exit(1)
1956:       rescue Exception => ex
1957:         # Exit with error message
1958:         $stderr.puts "rake aborted!"
1959:         $stderr.puts ex.message
1960:         if options.trace
1961:           $stderr.puts ex.backtrace.join("\n")
1962:         else
1963:           $stderr.puts ex.backtrace.find {|str| str =~ /#{@rakefile}/ } || ""
1964:           $stderr.puts "(See full trace by running task with --trace)"
1965:         end
1966:         exit(1)
1967:       end
1968:     end