In Files
- error.c
- signal.c
Files
- grammar.en.rdoc
- test.ja.rdoc
- contributing.rdoc
- contributors.rdoc
- dtrace_probes.rdoc
- extension.ja.rdoc
- extension.rdoc
- globals.rdoc
- keywords.rdoc
- maintainers.rdoc
- marshal.rdoc
- regexp.rdoc
- security.rdoc
- standard_library.rdoc
- syntax.rdoc
- assignment.rdoc
- calling_methods.rdoc
- control_expressions.rdoc
- exceptions.rdoc
- literals.rdoc
- methods.rdoc
- miscellaneous.rdoc
- modules_and_classes.rdoc
- precedence.rdoc
- refinements.rdoc
- README.ja.rdoc
- README.rdoc
Class/Module Index
- ArgumentError
- Array
- BasicObject
- Bignum
- Binding
- Class
- ClosedQueueError
- Comparable
- Complex
- Complex::compatible
- ConditionVariable
- Continuation
- Data
- Dir
- ENV
- EOFError
- Encoding
- Encoding::CompatibilityError
- Encoding::Converter
- Encoding::ConverterNotFoundError
- Encoding::InvalidByteSequenceError
- Encoding::UndefinedConversionError
- EncodingError
- Enumerable
- Enumerator
- Enumerator::Generator
- Enumerator::Lazy
- Enumerator::Yielder
- Errno
- Exception
- FalseClass
- Fiber
- FiberError
- File
- File::Constants
- File::Stat
- FileTest
- Fixnum
- Float
- FloatDomainError
- GC
- GC::Profiler
- Hash
- IO
- IO::EAGAINWaitReadable
- IO::EAGAINWaitWritable
- IO::EINPROGRESSWaitReadable
- IO::EINPROGRESSWaitWritable
- IO::EWOULDBLOCKWaitReadable
- IO::EWOULDBLOCKWaitWritable
- IO::WaitReadable
- IO::WaitWritable
- IOError
- IndexError
- Integer
- Interrupt
- Kernel
- KeyError
- LoadError
- LocalJumpError
- Marshal
- MatchData
- Math
- Math::DomainError
- Method
- Module
- NameError
- NilClass
- NoMemoryError
- NoMethodError
- NotImplementedError
- Numeric
- Object
- ObjectSpace
- ObjectSpace::WeakMap
- Proc
- Process
- Process::GID
- Process::Status
- Process::Sys
- Process::UID
- Process::Waiter
- Queue
- Random
- Random::Formatter
- Range
- RangeError
- Rational
- Rational::compatible
- Regexp
- RegexpError
- RubyVM
- RubyVM::Env
- RubyVM::InstructionSequence
- RuntimeError
- ScriptError
- SecurityError
- Signal
- SignalException
- SizedQueue
- StandardError
- StopIteration
- String
- Struct
- Symbol
- SyntaxError
- SystemCallError
- SystemExit
- SystemStackError
- Thread
- Thread::Backtrace::Location
- Thread::Mutex
- ThreadError
- ThreadGroup
- Time
- TracePoint
- TrueClass
- TypeError
- UnboundMethod
- UncaughtThrowError
- ZeroDivisionError
- fatal
- unknown
SignalException
Raised when a signal is received.
begin Process.kill('HUP',Process.pid) sleep # wait for receiver to handle signal sent by Process.kill rescue SignalException => e puts "received Exception #{e}" end
produces:
received Exception SIGHUP
Public Class Methods
new(sig_name) → signal_exception
click to toggle source
new(sig_number [, name]) → signal_exception
Construct a new SignalException object.
sig_name
should be a known signal name.
static VALUE esignal_init(int argc, VALUE *argv, VALUE self) { int argnum = 1; VALUE sig = Qnil; int signo; const char *signm; if (argc > 0) { sig = rb_check_to_integer(argv[0], "to_int"); if (!NIL_P(sig)) argnum = 2; else sig = argv[0]; } rb_check_arity(argc, 1, argnum); if (argnum == 2) { signo = NUM2INT(sig); if (signo < 0 || signo > NSIG) { rb_raise(rb_eArgError, "invalid signal number (%d)", signo); } if (argc > 1) { sig = argv[1]; } else { sig = rb_signo2signm(signo); } } else { int len = sizeof(signame_prefix); if (SYMBOL_P(sig)) sig = rb_sym2str(sig); else StringValue(sig); signm = RSTRING_PTR(sig); if (strncmp(signm, signame_prefix, len) == 0) { signm += len; len = 0; } signo = signm2signo(signm); if (!signo) { rb_raise(rb_eArgError, "unsupported name `%.*s%"PRIsVALUE"'", len, signame_prefix, sig); } sig = rb_sprintf("SIG%s", signm); } rb_call_super(1, &sig); rb_ivar_set(self, id_signo, INT2NUM(signo)); return self; }