Skip to content

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

Open
tyl0re wants to merge 1 commit into
ciembor:masterfrom
tyl0re:master
Open

puts makes the Output not Pipeable, with print the Output can be pars…#6
tyl0re wants to merge 1 commit into
ciembor:masterfrom
tyl0re:master

Conversation

@tyl0re

@tyl0re tyl0re commented Jul 14, 2020

Copy link
Copy Markdown

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

ciembor commented Jul 20, 2020

Copy link
Copy Markdown
Owner

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants