Signal trap and callback in mruby.
Signal.trap(:INT) { |signo|
p "hello signal #{Signal.signame(signo)}" #=> "hello signal INT"
}
- Signal.trap(sig, command){|signo| block }
- Signal.list
- Signal.signame(signo)
- Kernel.trap(sig, command){|signo| block }
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
MIT
https://github.com/ruby/ruby/blob/trunk/signal.c
Passed the ruby/spec
mruby-signal passed the below specs in ruby/spec