In Capistrano 2.x you could capture the output line by line using
run "ls -la" do |channel, stream, data|
puts data
end
This does not work in Capistrano 3.x, and the capture
and execute
commands do not seem to provide the same functionality.
Is there a way to replicate the 2.x behaviour in 3.x?
output = capture('cat ~/file.cnf')
output.each_line do |line|
puts line
end
Thats how I read lines using capture. If you want to capture something specific on a line you can use
if line.include? 'user'