C
Cai I.
I want to do something like this:
# open a session
@session = IO.popen('cmd.exe', 'r+')
# run a command and process outputs
@session.puts('dir')
@session.each do |line|
p line
end
# run a command line application
@session.puts('robocopy.exe ......')
@session.each do |line|
p line
end
The issue is that "@session.each" never stop. It waits when cmd.exe
waiting for input. So the scripts hang.
Thanks!
# open a session
@session = IO.popen('cmd.exe', 'r+')
# run a command and process outputs
@session.puts('dir')
@session.each do |line|
p line
end
# run a command line application
@session.puts('robocopy.exe ......')
@session.each do |line|
p line
end
The issue is that "@session.each" never stop. It waits when cmd.exe
waiting for input. So the scripts hang.
Thanks!