lib/celluloid/boot.rb in celluloid-0.12.4 vs lib/celluloid/boot.rb in celluloid-0.13.0.pre
- old
+ new
@@ -6,5 +6,18 @@
# Launch default services
# FIXME: We should set up the supervision hierarchy here
Celluloid::Notifications::Fanout.supervise_as :notifications_fanout
Celluloid::IncidentReporter.supervise_as :default_incident_reporter, STDERR
+
+# Terminate all actors at exit
+at_exit do
+ if defined?(RUBY_ENGINE) && RUBY_ENGINE == "ruby" && RUBY_VERSION >= "1.9"
+ # workaround for MRI bug losing exit status in at_exit block
+ # http://bugs.ruby-lang.org/issues/5218
+ exit_status = $!.status if $!.is_a?(SystemExit)
+ Celluloid.shutdown
+ exit exit_status if exit_status
+ else
+ Celluloid.shutdown
+ end
+end
\ No newline at end of file