I am on ubuntu. I need to automate testing of small utility juice.exe.
Yes, that one is windows command line application. It runs ok from wine.
The problem is that juice.exe every time asks me from command line to
enter 3 values: ip, host and some param. If developer who developed it
would only new about command line arguments, life would be easier, I
would place something like this in rake:
Can you get something to work with IO.popen? IO.popen allows you to use
a ruby program to read from juice.exe’s stdout, and you can use the ruby
program to write to juice.exe’s stdin.
So you could examine the question juice.exe sends to your ruby program
for a keyword, and then write the corresponding response(think hash).
Or, if you know that juice.exe asks for the same three things over and
over, you can just write a loop in your ruby program to write the three
One thing you have to know is: does juice.exe expect line oriented
input? In other words, does juice.exe consider a newline to be the end
of the response to its question? If so, then you need to write with
For reading, gets() will block until it reads a newline. Does juice.exe
end its questions with newlines? Do you even need to read the question?