public Method

Kernel.abort(...)

abort
Kernel::abort
Process::abort

Terminate execution immediately, effectively by calling Kernel.exit(1). If msg is given, it is written to STDERR prior to terminating.

Source Code

/*
*  call-seq:
*     abort
*     Kernel::abort
*     Process::abort
*  
*  Terminate execution immediately, effectively by calling
*  <code>Kernel.exit(1)</code>. If _msg_ is given, it is written
*  to STDERR prior to terminating.
*/

VALUE
rb_f_abort(argc, argv)
   int argc;
   VALUE *argv;
{
   rb_secure(4);
   if (argc == 0) {
       if (!NIL_P(ruby_errinfo)) {
           error_print();
       }
       rb_exit(EXIT_FAILURE);
   }
   else {
       VALUE mesg;

       rb_scan_args(argc, argv, "1", &mesg);
       StringValue(mesg);
       rb_io_puts(1, &mesg, rb_stderr);
       terminate_process(EXIT_FAILURE, mesg);
   }
   return Qnil;                /* not reached */
}
Comments

Have your say
Please use Textile formatting (click here for a cheat sheet). Use <code/> and <pre/> for code samples.
Click here to login with OpenID to to post comments.