I am trying to see if there is any way to return a value from cmd/batch in my ruby code.
I found this:
http://sketchucation.com/forums/viewtopic.php?f=180&t=35618
and in this example,
listing = %x[dir]
the cmd window pops up and runs, but my variable (listing) is empty
TIG
#2
You probably need to do a bit more… e.g
dir=Dir.pwd
tmp="#{rand}.tmp"
fil=File.join(dir, tmp)
system("dir > #{fil}")
until File.exist?(fil)
end
puts listing=IO.read(fil)
File.delete(fil)
What SU version Matt ?
There was one version that was broken but it is now fixed.
I had posted a quick fix which TIG had cleaned up and posted over at SCF, I think.
Remember that @TIG, a version or two ago. (It basically did a temp file fix.)
Strange, same version and works fine for me under Win 7.