about summary refs log tree commit homepage
path: root/lib
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2009-03-29 20:15:25 -0700
committerEric Wong <normalperson@yhbt.net>2009-03-29 20:59:56 -0700
commitab45d6d64d01631a0d8e4bdd5771e4dce650f545 (patch)
treeb5cc1ef0d448030754e8c382e797cb8450a96595 /lib
parent066226e97c1a08f927f62ae50d7e95a9ada4f303 (diff)
downloadunicorn-ab45d6d64d01631a0d8e4bdd5771e4dce650f545.tar.gz
It makes test_exec more reliable and probably helps
other scripts people may run around this.
Diffstat (limited to 'lib')
-rw-r--r--lib/unicorn.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/unicorn.rb b/lib/unicorn.rb
index d56f251..f99b433 100644
--- a/lib/unicorn.rb
+++ b/lib/unicorn.rb
@@ -124,9 +124,9 @@ module Unicorn
           raise ArgumentError, "Already running on PID:#{x} " \
                                "(or pid=#{path} is stale)"
         end
-        File.open(path, 'wb') { |fp| fp.syswrite("#{$$}\n") }
       end
-      unlink_pid_safe(@pid) if @pid && @pid != path
+      unlink_pid_safe(@pid) if @pid
+      File.open(path, 'wb') { |fp| fp.syswrite("#$$\n") } if path
       @pid = path
     end