From 1cb7c7f7856c8744cad9fdfb1effd8f9f228ea1c Mon Sep 17 00:00:00 2001 From: Evan Phoenix Date: Thu, 18 Jul 2013 09:26:26 -0700 Subject: [PATCH] Be sure to only delete the pid in the master. Fixes #334 --- lib/puma/cli.rb | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/lib/puma/cli.rb b/lib/puma/cli.rb index 4f7ca6f8..c7e8d1f8 100644 --- a/lib/puma/cli.rb +++ b/lib/puma/cli.rb @@ -235,7 +235,13 @@ module Puma f.puts Process.pid end - at_exit { delete_pidfile } + cur = Process.pid + + at_exit do + if cur == Process.pid + delete_pidfile + end + end end end @@ -443,6 +449,9 @@ module Puma when :exit # nothing end + + ensure + delete_pidfile end def setup_signals