Question

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
Was it helpful?

Solution

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

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top