在Ruby中从系统调用收集Exe printf输出
我想将系统调用的exe文件(foo.exe)的printf输出存储在ruby中,并获取退出状态。我该怎么做?是最好的方法在Ruby中从系统调用收集Exe printf输出,ruby,Ruby,我想将系统调用的exe文件(foo.exe)的printf输出存储在ruby中,并获取退出状态。我该怎么做?是最好的方法 require 'open3' Open3.popen3('foo.exe') do |stdin, stdout, stderr, thr| status = thr.value output = stdout.read errors = stderr.read end 可能会有帮助
require 'open3'
Open3.popen3('foo.exe') do |stdin, stdout, stderr, thr|
status = thr.value
output = stdout.read
errors = stderr.read
end
可能会有帮助