Skip to content
Browse files

Merge pull request #11 from fabiokung/master

Support for process names with spaces on Linux
  • Loading branch information...
2 parents 90d80c2 + 6e5da30 commit bf9aac93060998b154c5c48ea9c766715cd0f078 @fabiokung fabiokung committed Mar 14, 2012
Showing with 51 additions and 9 deletions.
  1. +1 −0 .gitignore
  2. +3 −0 Gemfile
  3. +32 −0 Gemfile.lock
  4. +1 −1 VERSION
  5. +9 −7 lib/rush/local.rb
  6. +5 −1 rush.gemspec
View
1 .gitignore
@@ -1,2 +1,3 @@
rdoc
pkg
+.rbenv-version
View
3 Gemfile
@@ -0,0 +1,3 @@
+source "http://rubygems.org"
+
+gemspec
View
32 Gemfile.lock
@@ -0,0 +1,32 @@
+PATH
+ remote: .
+ specs:
+ rush (0.6.8)
+ session
+
+GEM
+ remote: http://rubygems.org/
+ specs:
+ fattr (2.2.0)
+ git (1.2.5)
+ jeweler (1.8.3)
+ bundler (~> 1.0)
+ git (>= 1.2.5)
+ rake
+ rdoc
+ json (1.6.5)
+ rake (0.9.2.2)
+ rdoc (3.12)
+ json (~> 1.4)
+ rspec (1.2.9)
+ session (3.1.0)
+ fattr
+
+PLATFORMS
+ ruby
+
+DEPENDENCIES
+ jeweler (>= 1.8.3)
+ rake (>= 0.9.0)
+ rspec (~> 1.2.0)
+ rush!
View
2 VERSION
@@ -1 +1 @@
-0.6.6
+0.6.8
View
16 lib/rush/local.rb
@@ -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
{
View
6 rush.gemspec
@@ -5,7 +5,7 @@
Gem::Specification.new do |s|
s.name = %q{rush}
- s.version = "0.6.6"
+ s.version = "0.6.8"
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
s.authors = ["Adam Wiggins"]
@@ -97,6 +97,10 @@ Gem::Specification.new do |s|
"spec/string_ext_spec.rb"
]
+ s.add_development_dependency("rake", [">= 0.9.0"])
+ s.add_development_dependency("jeweler", [">= 1.8.3"])
+ s.add_development_dependency("rspec", ["~> 1.2.0"])
+
if s.respond_to? :specification_version then
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
s.specification_version = 3

0 comments on commit bf9aac9

Please sign in to comment.
Something went wrong with that request. Please try again.