Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

parses processes with spaces in their names. This fixes #10

  • Loading branch information...
commit 0eed0d2f4708e1ee2a5eab270342ee1325e0f6ad 1 parent cf17784
Fabio Kung fabiokung authored
Showing with 9 additions and 7 deletions.
  1. +9 −7 lib/rush/local.rb
16 lib/rush/local.rb
View
@@ -193,16 +193,18 @@ def resolve_unix_uid_to_user(uid)
# Read a single file in /proc and store the parsed values in a hash suitable
# for use in the Rush::Process#new.
def read_proc_file(file)
- data = ::File.read(file).split(" ")
+ stat_contents = ::File.read(file)
+ stat_contents.gsub!(/\((.*)\)/, "")
+ command = $1
+ data = stat_contents.split(" ")
uid = ::File.stat(file).uid
pid = data[0]
- command = data[1].match(/^\((.*)\)$/)[1]
cmdline = ::File.read("/proc/#{pid}/cmdline").gsub(/\0/, ' ')
- parent_pid = data[3].to_i
- utime = data[13].to_i
- ktime = data[14].to_i
- vss = data[22].to_i / 1024
- rss = data[23].to_i * 4
+ parent_pid = data[2].to_i
+ utime = data[12].to_i
+ ktime = data[13].to_i
+ vss = data[21].to_i / 1024
+ rss = data[22].to_i * 4
time = utime + ktime
{
Please sign in to comment.
Something went wrong with that request. Please try again.