Edit: This just got marked as a duplicate of a question on calling a Bash command. I daresay anyone familiar with programming should be aware that "calling a Bash command" is vastly different from sucking down a resource by HTTP and sending its output to another program.
Does anyone have sample code showing how to achieve this kind of thing in Ruby:
curl http://stackoverflow.com | wc
I know I could use system, but would ideally like to keep it pure Ruby using IO.pipe or whatnot.
Use Open3::pipeline method. For example:
require 'open3'
Open3.pipeline(['curl', 'http://stackoverflow.com'],
['wc'])
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With