How can I store the string value in stdout
from the following Ruby code?
stdin, stdout, stderr = Open3.popen3('grep something test.txt')
I can display the value like this: stdout.gets
. However trying to store the value like this: s = stdout.gets
just sets s
to nil
. Trying to store the value like this: s = stdout
stores something like "#<IO:0x1003abe10>"
in s
.
output = stdout.read
seems to work.