capistrano: saving a result on var

B

botp

Hi All,
sorry if this dumb and not pure ruby q, but i just hit a bump on capistrano.

how does one get a result of a run or sudo?

eg,

task :testing do
x = run "date"
p x
end

it runs without error but i get nothing (nil ie) from x

kind regards -botp
 
J

Jean-Julien Fleck

Hello botp,
task :testing do
=A0x =3D run "date"
=A0p x
end

it runs without error but i get nothing (nil ie) from x

Use backstiks:
"Sun Jan 17 16:18:45 CET 2010\n"
=3D> nil

Cheers,

--=20
JJ Fleck
PCSI1 Lyc=E9e Kl=E9ber
 
B

botp

sorry if this dumb and not pure ruby q, but i just hit a bump on capistrano.
....


pls ignore.

i found #capture and #stream

sorry for the noise

kind regards -botp
 
D

David Masover

Hello botp,


Use backstiks:

=> "Sun Jan 17 16:18:45 CET 2010\n"

I don't know why you'd want to run 'date' instead of Time.now from within
Ruby, but the one reason I can think of is that Capistrano's #run isn't the
equivalent of #system -- it runs a command on the remote system. I'm guessing
the point here is to do something with the remote system's date, specifically.
In that case, `date` is useless, as backticks run commands locally.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,160
Messages
2,570,890
Members
47,423
Latest member
henerygril

Latest Threads

Top