Aw
Aw, fork! 😬
Creates a subprocess to execute a block inside.
Installation
Add this line to your application's Gemfile:
gem "aw"
And then execute:
$ bundle
Or install it yourself as:
$ gem install aw
Usage
It executes the block in a subprocess, and returns the result in the current process:
Aw.fork! { 6 * 7 } # => 42
Of course, it prevents from side effects:
arr = ["foo"]
Aw.fork! { arr << "FUU" } # => ["foo", "FUU"]
arr # => ["foo"]
Exceptions raised within the block are propagated:
Aw.fork! { nil + 1 } # => NoMethodError (undefined method `+' for nil:NilClass)
Contact
- Source code: https://github.com/fixrb/aw
Versioning
Aw follows Semantic Versioning 2.0.
License
The gem is available as open source under the terms of the MIT License.