Signal trap and callback in mruby.
Synopsis
Signal.trap(:INT) { |signo| p "hello signal #{Signal.signame(signo)}" #=> "hello signal INT" }
Methods
- Signal.trap(sig, command){|signo| block }
- Signal.list
- Signal.signame(signo)
- Kernel.trap(sig, command){|signo| block }
Installation
Write in /mruby/build_config.rb
MRuby::Build.new do |conf| # from mgem conf.gem :mgem => 'mruby-signal' # or from github conf.gem :github => 'ksss/mruby-signal', :branch => 'master' end
License
MIT
Based on
https://github.com/ruby/ruby/blob/trunk/signal.c
Passed the ruby/spec
mruby-signal passed the below specs in ruby/spec