Kevin Kaske
Kevin Kaske

Reputation: 1139

How can I get a command executed in Capistrano 3 into a variable?

I'm trying to run execute on a command like below in my deploy.rb:

results = execute 'somecommand'

It does not seem that execute returns the results of the command. What is the correct way to do this?

Upvotes: 2

Views: 1129

Answers (1)

Matt Brictson
Matt Brictson

Reputation: 11082

You want to use the capture command.

result = capture(:echo, "hello world")
result # => "hello world"

An example is also shown on the home page of the Capistrano docs: http://capistranorb.com

Upvotes: 6

Related Questions