2010/8/24 Jeppe J. [email protected]:
Is it possible to make some kind of program hook in ruby, so I can have
the program in question send it’s calls to my ruby script first, and
then have ruby forward them to the program?
If so, please throw me a link where I can read on the subject. Tried to
look into some win32API docs, but didn´t find what I was looking for.
You can also use #expect from the standard lib:
IO.popen “your command”, “r+” do |io|
prompt_seen = false
io.expect “>”, 100 do |line|
prompt_seen = true
printf “Got prompt: %p\n”, line
puts “no prompt in time!” unless prompt_seen
io.puts “exit” # for shells and other interactive programs
The code is untested but should get you going into the right direction.