gpt4 book ai didi

ruby - 如何从 Albacore exec 任务获取命令输出?

转载 作者:太空宇宙 更新时间:2023-11-03 16:08:40 26 4
gpt4 key购买 nike

有没有办法获取exec任务的命令输出?

exec :checkout do |cmd|
cmd.command = 'C:/Program Files (x86)/Microsoft Visual Studio 10.0/Common7/IDE/tf.exe'
cmd.parameters 'checkout'
end

最佳答案

您提到了长鳍金枪鱼并使用了任务 exec。如果没有特别需要长鳍金枪鱼,你可以使用标准的 ruby​​ 工具:

#Define the command:
cmd = 'dir'
#or in your case:
#cmd ['"C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\tf.exe"',
# 'checkout'].join(' ')


#Version one:
output = `#{cmd}`
puts output

#Version two:
output = %x{#{cmd}}
puts output

更多解决方案可以在 Getting output of system() calls in Ruby 找到

关于ruby - 如何从 Albacore exec 任务获取命令输出?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8596994/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com