about summary refs log tree commit homepage
path: root/bin
diff options
context:
space:
mode:
authorzedshaw <zedshaw@19e92222-5c0b-0410-8929-a290d50e31e9>2006-08-14 05:32:19 +0000
committerzedshaw <zedshaw@19e92222-5c0b-0410-8929-a290d50e31e9>2006-08-14 05:32:19 +0000
commitc3f8c8d25c4309d3e06491090b5b53825010ac29 (patch)
tree0ce511ddb2d8ea9a751c33386b36e5f4a463fccc /bin
parentc355f1057f59abfcd3e5212d6569dd6a37960029 (diff)
downloadunicorn-c3f8c8d25c4309d3e06491090b5b53825010ac29.tar.gz
git-svn-id: svn+ssh://rubyforge.org/var/svn/mongrel/trunk@324 19e92222-5c0b-0410-8929-a290d50e31e9
Diffstat (limited to 'bin')
-rw-r--r--bin/mongrel_rails22
1 files changed, 10 insertions, 12 deletions
diff --git a/bin/mongrel_rails b/bin/mongrel_rails
index d0bd9c0..9220000 100644
--- a/bin/mongrel_rails
+++ b/bin/mongrel_rails
@@ -165,20 +165,19 @@ class Stop < GemPlugin::Plugin "/commands"
 
   def configure
     options [
-      ['-c', '--chdir PATH', "Change to dir before starting (will be expanded)", :@cwd, nil],
+      ['-c', '--chdir PATH', "Change to dir before starting (will be expanded)", :@cwd, "."],
       ['-f', '--force', "Force the shutdown.", :@force, false],
       ['-P', '--pid FILE', "Where the PID file is located", :@pid_file, "log/mongrel.pid"]
     ]
   end
 
   def validate
-    if @cwd
-      @cwd = File.expand_path(@cwd)
-      valid_dir? @cwd, "Invalid path to change to during daemon mode: #@cwd"
-    end
+    @cwd = File.expand_path(@cwd)
+    valid_dir? @cwd, "Invalid path to change to during daemon mode: #@cwd"
 
-    valid_exists? @pid_file, "PID file #@pid_file does not exist. Not running?"
+    Dir.chdir @cwd
 
+    valid_exists? @pid_file, "PID file #@pid_file does not exist. Not running?"
     return @valid
   end
 
@@ -199,20 +198,19 @@ class Restart < GemPlugin::Plugin "/commands"
 
   def configure
     options [
-      ['-c', '--chdir PATH', "Change to dir before starting (will be expanded)", :@cwd, nil],
+      ['-c', '--chdir PATH', "Change to dir before starting (will be expanded)", :@cwd, '.'],
       ['-s', '--soft', "Do a soft restart rather than a process exit restart", :@soft, false],
       ['-P', '--pid FILE', "Where the PID file is located", :@pid_file, "log/mongrel.pid"]
     ]
   end
 
   def validate
-    if @cwd
-      @cwd = File.expand_path(@cwd)
-      valid_dir? @cwd, "Invalid path to change to during daemon mode: #@cwd"
-    end
+    @cwd = File.expand_path(@cwd)
+    valid_dir? @cwd, "Invalid path to change to during daemon mode: #@cwd"
 
-    valid_exists? @pid_file, "PID file #@pid_file does not exist. Not running?"
+    Dir.chdir @cwd
 
+    valid_exists? @pid_file, "PID file #@pid_file does not exist. Not running?"
     return @valid
   end