Skip to content

Propagate the exception from the child process into the parent

License

Notifications You must be signed in to change notification settings

julik/exceptional_fork

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

exceptional_fork

Fork with a block and wait until the forked child exits. Any exceptions raised within the block will be re-raised from this in the parent process (where you call it from).

ExceptionalFork.fork_and_wait { raise "Explosion! "} # raises a RuntimeError

or for something that runs longer:

ExceptionalFork.fork_and_wait do
  perform_long_running_job! # this raises some EOFError or another
end
#=> EOFError... # more data and the backtrace.

It is not guaranteed that all the exception metadata will be reinstated due to marshaling/unmarshaling mechanics, but it helps debugging nevertheless.

Contributing to exceptional_fork

  • Check out the latest master to make sure the feature hasn’t been implemented or the bug hasn’t been fixed yet.

  • Check out the issue tracker to make sure someone already hasn’t requested it and/or contributed it.

  • Fork the project.

  • Start a feature/bugfix branch.

  • Commit and push until you are happy with your contribution.

  • Make sure to add tests for it. This is important so I don’t break it in a future version unintentionally.

  • Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.

Copyright © 2014 Julik Tarkhanov. See LICENSE.txt for further details.

About

Propagate the exception from the child process into the parent

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages