似乎这也适用于 Windows
pipe = IO.popen('your.exe', 'w+', :err => [:child, :out])
@pipe.each_line do |line|
if /pattern matching question/ =~ line
break
end
end
pipe.puts('Yes')
# another test can be here
pipe.close
明智地与https://ruby-doc.com/stdlib/libdoc/timeout/rdoc/Timeout.html一起使用
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句