When I run this simple ruby script:
a = `curl localhost`
puts "Result is: #{a}"
=> % Total % Received % Xferd Average Speed Time Time Time CurrentDload Upload Total Spent Left Speed
=> 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0curl: (7) Failed to connect to localhost port 80: Connection refused
=> Result is:
See that the result is being printed when the command is ran, and the variable is empty. But if I run any other command in the same format it works as I expect:
a = `ls`
puts "Result is: #{a}"
=> Result is: test.rb
How can I store the results of the first curl command into a variable?