2
有没有办法获得exec任务的命令输出?如何从Albacore 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任务的命令输出?如何从Albacore exec任务获取命令输出?
exec :checkout do |cmd|
cmd.command = 'C:/Program Files (x86)/Microsoft Visual Studio 10.0/Common7/IDE/tf.exe'
cmd.parameters 'checkout'
end
您提到了albacore,并且您使用任务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
找到你的意思是命令或返回代码的输出是什么? – knut 2011-12-21 22:10:50
命令的输出 – icn 2011-12-21 23:07:03
你一定是指控制台输出而不是退出代码?因为'tf.exe checkout'不会产生任何有趣的内容(“没有指定文件”)。你能说出你想用这个输出做什么,所以我可以帮助(我维护Albacore)。 – 2012-09-28 21:11:28