newrelic/rpm — comment on commit 182081cd358c27be75dbfaa83a2ed9a6165541c3
File:  line 0
By kovyrin:

You have a bug. You need to implement proper reading till the EOF is reached or you'll be getting problems like this:

```
root@b7:~$ cat /proc/cpuinfo | grep ^processor
processor	: 0
processor	: 1
processor	: 2
processor	: 3
processor	: 4
processor	: 5
processor	: 6
processor	: 7
processor	: 8
processor	: 9
processor	: 10
processor	: 11
processor	: 12
processor	: 13
processor	: 14
processor	: 15
root@b7:~$ cat /proc/cpuinfo | grep ^processor | wc -l
16
root@b7:~$ irb
irb(main):001:0> cpuinfo = File.open("/proc/cpuinfo") {|f| f.read_nonblock(4096).strip }; nil
=> nil
irb(main):002:0> processors = cpuinfo.split("\n").select {|line| line =~ /^processor\s*:/ }.size
=> 5
```

As you can see, your code returns 5 on a 16 core machine.