<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -260,6 +260,7 @@ module Merb
                   &quot;merb proceses by port number.  Use merb -K all to &quot; \
                   &quot;gracefully kill all merbs.&quot;) do |ports|
             options[:action] = :kill
+            ports = &quot;main&quot; if ports == &quot;all&quot;
             options[:port] = ports
           end
 
@@ -267,6 +268,7 @@ module Merb
                   &quot;by port number. This will cause the worker to&quot; \
                   &quot;be respawned. If you want to kill &quot;) do |port|
             options[:action] = :kill_9
+            port = &quot;main&quot; if port == &quot;all&quot;
             options[:port] = port
           end
 </diff>
      <filename>lib/merb-core/config.rb</filename>
    </modified>
    <modified>
      <diff>@@ -71,31 +71,46 @@ module Merb
       def kill(port, sig=&quot;INT&quot;)
         Merb::BootLoader::BuildFramework.run
         begin
-          port = &quot;gid&quot; if port == &quot;all&quot;
-          pid = File.read(pid_file(port)).chomp.to_i
-          
-          kill_pid(sig, pid, pid_file(port))
-          kill_pid(sig, -pid, pid_file(port))
-        ensure
-          Merb.started = false
-          exit
+          if sig == 9 &amp;&amp; port == &quot;main&quot;
+            Dir[&quot;#{Merb.log_path}&quot; / &quot;*.pid&quot;].each do |file|
+              kill_pid(9, File.read(file).chomp.to_i, file)
+            end
+          else
+            pid = File.read(pid_file(port)).chomp.to_i
+            kill_pid(sig, pid, pid_file(port))
+          end
+        rescue Errno::EACCES =&gt; e
+          Merb.fatal! e.message, e
+        rescue Errno::ENOENT =&gt; e
+          Merb.fatal! &quot;Could not find a PID file at #{pid_file(port)}&quot;, e
+        end
+        if sig.is_a?(Integer)
+          sig = Signal.list.invert[sig]
+        end
+        if sig == &quot;KILL&quot; &amp;&amp; port == &quot;main&quot;
+          Merb.fatal! &quot;Killed all PIDs with signal KILL&quot;
+        else
+          Merb.fatal! &quot;Killed #{port} with signal #{sig}&quot;
         end
       end
       
-      def kill_pid(sig, pid)
+      def kill_pid(sig, pid, file)
         begin
           Process.kill(sig, pid)
-          FileUtils.rm(f) if File.exist?(f)
-          puts &quot;killed PID #{pid} with signal #{sig}&quot;
+          FileUtils.rm(file) if File.exist?(file)
         rescue Errno::EINVAL
-          puts &quot;Failed to kill PID #{pid}: '#{sig}' is an invalid or unsupported signal number.&quot;
+          Merb.fatal! &quot;Failed to kill PID #{pid}: '#{sig}' is an invalid &quot; \
+            &quot;or unsupported signal number.&quot;
         rescue Errno::EPERM
-          puts &quot;Failed to kill PID #{pid}: Insufficient permissions.&quot;
+          Merb.fatal! &quot;Failed to kill PID #{pid}: Insufficient permissions.&quot;
         rescue Errno::ESRCH
-          puts &quot;Failed to kill PID #{pid}: Process is deceased or zombie.&quot;
-          FileUtils.rm f
+          FileUtils.rm file
+          Merb.fatal! &quot;Failed to kill PID #{pid}: Process is &quot; \
+            &quot;deceased or zombie.&quot;
         rescue Exception =&gt; e
-          puts &quot;Failed to kill PID #{pid}: #{e.message}&quot;
+          if !e.is_a?(SystemExit)
+            Merb.fatal! &quot;Failed to kill PID #{pid}&quot;, e
+          end
         end        
       end
 
@@ -186,12 +201,8 @@ module Merb
         FileUtils.rm(pid_file(port)) if File.file?(pid_file(port))
       end
 
-      def store_gid
-        store_details
-      end
-      
-      def store_details(port = nil, type = port ? &quot;pid&quot; : &quot;gid&quot;)
-        file = pid_file(port || type)
+      def store_details(port = nil)
+        file = pid_file(port)
         begin
           FileUtils.mkdir_p(File.dirname(file))
         rescue Errno::EACCES =&gt; e
@@ -199,7 +210,7 @@ module Merb
             &quot;but you did not have access.&quot;, e
         end
         Merb.logger.warn! &quot;Storing #{type} file to #{file}...&quot; if Merb::Config[:verbose]
-        File.open(file, 'w'){ |f| f.write(Process.pid.to_s) }        
+        File.open(file, 'w'){ |f| f.write(Process.pid.to_s) }
       end
 
       # Gets the pid file for the specified port.</diff>
      <filename>lib/merb-core/server.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>eb52fcec508a458af4d2d286223960b24a2954c3</id>
    </parent>
  </parents>
  <author>
    <name>Yehuda Katz</name>
    <email>wycats@gmail.com</email>
  </author>
  <url>http://github.com/wycats/merb-core/commit/67e1756c267edb27f0229e0e7f9883736868742a</url>
  <id>67e1756c267edb27f0229e0e7f9883736868742a</id>
  <committed-date>2008-09-27T18:27:12-07:00</committed-date>
  <authored-date>2008-09-27T13:14:16-07:00</authored-date>
  <message>get merb -k and merb -K to work (with and without `all')</message>
  <tree>08412e7875ad02914fc7ffafed26f0c2461505f5</tree>
  <committer>
    <name>Yehuda Katz</name>
    <email>wycats@gmail.com</email>
  </committer>
</commit>
