Pregunta

Is there a way to get the command output of the exec task?

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

Solución

You mentioned albacore and you use the task exec. If there is no special need of albacore you may use standard ruby tools:

#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

More solutions may be found at Getting output of system() calls in Ruby

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top