about summary refs log tree commit homepage
path: root/lib/zbatery.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/zbatery.rb')
-rw-r--r--lib/zbatery.rb3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/zbatery.rb b/lib/zbatery.rb
index 08ac5b1..735b1e6 100644
--- a/lib/zbatery.rb
+++ b/lib/zbatery.rb
@@ -75,6 +75,7 @@ module Rainbows
     end
 
     def join
+      at_exit { unlink_pid_safe(pid) if pid }
       trap(:INT) { exit!(0) }
       trap(:TERM) { exit!(0) }
       trap(:QUIT) { Thread.new { stop } }
@@ -102,7 +103,7 @@ module Rainbows
 
     def stop(graceful = true)
       Rainbows.quit!
-      exit!(0) unless graceful
+      graceful ? exit : exit!(0)
     end
 
     def before_fork