dobra-noc / gm1356

Digital Sound Level Meter Gm1356 USB driver for Linux
41 stars 9 forks source link

puts makes the Output not Pipeable, with print the Output can be pars… #6

Open tyl0re opened 4 years ago

tyl0re commented 4 years ago

I don't know anything about ruby, but it seems puts Buffers the Output ,so piping "|grep xy" doesn't work. With print the output can now be parsed

ciembor commented 4 years ago

Thanks for your PR. I checked and it looks grep works with puts. This is how I tested it:

(1..10).each_with_index do |i|
  puts "number #{i}"
end
[~]$ ruby a.rb | grep "number"                                                                                                                                *[master][2.6.3] 
number 1
number 2
number 3
number 4
number 5
number 6
number 7
number 8
number 9
number 10
[~]$ ruby a.rb | grep "5"                                                                                                                                     *[master][2.6.3] 
number 5
[~]$

@tyl0re so it looks it works with grep. Or you had some other usecase where it didn't work, if yes, could you share it?