-
Notifications
You must be signed in to change notification settings - Fork 0
2.x DSL Action Inspection Capture
Definition
capture(command, options={})
Module
Capistrano::Configuration::Actions::Inspect
The capture helper will execute the given command on the first matching server, and will return the output of the command as a string.
version = capture("cat /u/apps/social/current/REVISION")
This must be a string containing the shell command (or commands) to execute. It has identical semantics and syntax to the command argument for the run helper.
See run for a full description of all supported options. The only exception is the :once option, which capture ignores. (It will only run on the first matching server, regardless of the value of the :once option.)
The capture helper will only return output that the command emits on stdout. Anything sent via stderr will be echoed to the terminal and otherwise ignored. If you wish to capture both stderr and stdout, you'll need to redirect stderr to stdout:
whole_enchilada = capture("ls -l 2>&1")