https://github.com/ksss/mruby-signal
Signal class implementation for mruby
https://github.com/ksss/mruby-signal
mruby signal
Last synced: 9 months ago
JSON representation
Signal class implementation for mruby
- Host: GitHub
- URL: https://github.com/ksss/mruby-signal
- Owner: ksss
- License: mit
- Created: 2014-05-27T12:13:04.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2024-11-23T12:15:34.000Z (about 1 year ago)
- Last Synced: 2025-03-25T07:23:29.564Z (10 months ago)
- Topics: mruby, signal
- Language: C
- Homepage:
- Size: 90.8 KB
- Stars: 5
- Watchers: 5
- Forks: 5
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# mruby-signal
[](https://travis-ci.org/ksss/mruby-signal)
Signal trap and callback in mruby.
## Synopsis
```ruby
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
```ruby
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](https://github.com/ruby/ruby/blob/trunk/signal.c)
## Passed the [ruby/spec](https://github.com/ruby/spec)
mruby-signal passed the below specs in ruby/spec
- [core/signal/*](https://github.com/ruby/spec/tree/master/core/signal)
- [core/exception/interrupt_spec.rb](https://github.com/ruby/spec/blob/master/core/exception/interrupt_spec.rb)
- [core/exception/signal_exception_spec.rb](https://github.com/ruby/spec/blob/master/core/exception/signal_exception_spec.rb)
## See also
[http://ruby-doc.org/core-2.3.1/Signal.html](http://ruby-doc.org/core-2.3.1/Signal.html)