Each run() is done in a subshell, so any changes made to your  
session's state there are lost. Similarly, you cannot set environment  
variables that you want to persist across run calls, either.

The way to do this is to execute all the commands together in a single  
run() invocation:

   run "cd /path && ls -al"

- Jamis

On Oct 8, 2008, at 2:45 AM, thomas.mery wrote:

>
> Hello all,
>
> Maybe this ha been answered before but could not find the solution ...
>
> I simply want to change directory within a task to be able to run a
> command in a specific directory
>
> but it fails ....
>
> here is my test task :
>
> desc "TEST"
> task :test do
>
>       run "cd /home/myaccount/mydirectory"
>        run ""ls -al"
>
> end
>
> the output of the ls command will show the content of my user
> directory (the one I access when logging in) but not the content of
> the directory I 'cd'ed into (output shows no error when issuing the cd
> command)
>
> I am probably missing something obvious here but I would really
> appreciate any insight :)
>
> thanks in advance
>
> thomas
>
> >


--~--~---------~--~----~------------~-------~--~----~
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/capistrano
-~----------~----~----~----~------~----~------~--~---

Reply via email to