Return Value from CMD via Ruby

I am trying to see if there is any way to return a value from cmd/batch in my ruby code.

I found this:

and in this example,
listing = %x[dir]
the cmd window pops up and runs, but my variable (listing) is empty

You probably need to do a bit more… e.g

fil=File.join(dir, tmp)
system("dir > #{fil}")
until File.exist?(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.