diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2006-04-28 03:46:17 +0000 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2006-04-28 03:46:17 +0000 |
commit | de69de10ded1c0d124f974f995ce31fd68b774d2 (patch) | |
tree | 617f6e33b8d5d8a22710c1cf9b358889c1b28256 /railties | |
parent | 4a218de694c8f77a396f1dc55c828b4a3f693d23 (diff) | |
download | rails-de69de10ded1c0d124f974f995ce31fd68b774d2.tar.gz rails-de69de10ded1c0d124f974f995ce31fd68b774d2.tar.bz2 rails-de69de10ded1c0d124f974f995ce31fd68b774d2.zip |
Status in one line
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4299 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'railties')
-rw-r--r-- | railties/lib/commands/process/inspector.rb | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/railties/lib/commands/process/inspector.rb b/railties/lib/commands/process/inspector.rb index cc17db6ac1..c723f1199a 100644 --- a/railties/lib/commands/process/inspector.rb +++ b/railties/lib/commands/process/inspector.rb @@ -5,7 +5,7 @@ if RUBY_PLATFORM =~ /mswin32/ then abort("Reaper is only for Unix") end OPTIONS = { :pid_path => File.expand_path(RAILS_ROOT + '/tmp/pids'), :pattern => "dispatch.*.pid", - :ps => "ps -o user,start,etime,pcpu,vsz,majflt,command -p %s" + :ps => "ps -o pid,state,user,start,time,pcpu,vsz,majflt,command -p %s" } class Inspector @@ -18,17 +18,16 @@ class Inspector end def inspect - for process in find_processes - puts "#{File.basename(process[:pid_file])}:" - puts(`#{OPTIONS[:ps] % process[:pid]}`) - puts - end + header = `#{OPTIONS[:ps] % 0}`.split("\n")[0] + "\n" + lines = pids.collect { |pid| `#{OPTIONS[:ps] % pid}`.split("\n")[1] } + + puts(header + lines.join("\n")) end private - def find_processes - pid_files.inject([]) do |pids, pid_file| - pids << { :pid_file => pid_file, :pid => File.read(pid_file).to_i } + def pids + pid_files.collect do |pid_file| + File.read(pid_file).to_i end end |