serverspec/specinfra — pull request #108 by aibou (2014-05-07 12:22:05+00:00)
Title: Fix to get matched all processes on Command::Base#get_process

When some processes were running with same command name but has different arguments, such as

```
$ pgrep java -lf
25817 java Main
25844 java Hoge
25856 java Fuga
```

I tried to execute `spec/localhost/java_spec.rb` but its failed.
Because `Command::Base#get_process` gets only 1 process using `| head -1` .

```
$ cat spec/localhost/java_spec.rb
require 'spec_helper'

describe process('java') do
it { should be_running }
its(:args) { should match /Main/ }
its(:args) { should match /Hoge/ }
its(:args) { should match /Fuga/ }
end

$ rake spec
/usr/bin/ruby1.9 -S rspec spec/localhost/java_spec.rb
..FF

Failures:

1) Process "java" args should match /Hoge/
Failure/Error: its(:args) { should match /Hoge/ }
ps -C java -o args= | head -1
java Main
expected "java Main" to match /Hoge/
Diff:
@@ -1,2 +1,2 @@
-/Hoge/
+"java Main"
# ./spec/localhost/java_spec.rb:6:in `block (2 levels) in '

2) Process "java" args should match /Fuga/
Failure/Error: its(:args) { should match /Fuga/ }
ps -C java -o args= | head -1
java Main
expected "java Main" to match /Fuga/
Diff:
@@ -1,2 +1,2 @@
-/Fuga/
+"java Main"
# ./spec/localhost/java_spec.rb:7:in `block (2 levels) in '

Finished in 0.09278 seconds
4 examples, 2 failures

Failed examples:

rspec ./spec/localhost/java_spec.rb:6 # Process "java" args should match /Hoge/
rspec ./spec/localhost/java_spec.rb:7 # Process "java" args should match /Fuga/
/usr/bin/ruby1.9 -S rspec spec/localhost/java_spec.rb failed
```

This problem should be solved by my commit however there may be better solution.
Could you give me your comment?