Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to capture output from a remote command in Capistrano?

Tags:

I want to run a remote command (git diff of current_revision and HEAD in a few folders) and capture the output.

I've tried run("git diff rev1 rev2 -- folder | cat"), but the method always returns seems to return nil (even when I can see the diff output in the Capistrano output).

Any ideas? Can I use different means of piping the command, or anything like that? Im not a Unix wizard, so it could be something trivial Im missing here.

like image 588
Richard Johansson Avatar asked Jan 18 '11 10:01

Richard Johansson


1 Answers

Maybe capture?

"The capture helper will execute the given command on the first matching server, and will return the output of the command as a string."

https://github.com/capistrano/capistrano/wiki/2.x-DSL-Action-Inspection-Capture

like image 196
Heikki Avatar answered Sep 19 '22 18:09

Heikki