Forum: Ruby on Rails Capistrano: env not setup properly over ssh

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Christopher J. Bottaro (Guest)
on 2006-03-29 00:39
Hi,
If I make a Capistrano task like

task :test, :roles => :app do
  run "env"
end

It prints something completely different than if I just do

ssh login@host env

I need all my login scripts to run so all my environment vars (including
PATH) are set.  All my Capistrano tasks are failing because the paths
are setup properly.

Thanks for the help.
Jamis B. (Guest)
on 2006-03-29 02:23
(Received via mailing list)
On Mar 28, 2006, at 1:39 PM, Christopher J. Bottaro wrote:

>
> I need all my login scripts to run so all my environment vars
> (including
> PATH) are set.  All my Capistrano tasks are failing because the paths
> are setup properly.

If I do

   ssh login@host env

I get a very different env than if I log into that box and run env
from the cli. I'm not sure why you'd be getting the full environment
in the former case.

Capistrano basically executes each command in a very basic shell, not
a login shell, which means your PATH and so forth won't be set. If
you need each command to execute within a fully initialized login
environment, you can try doing something like:

   task :test do
     run "bash -l -c env"
   end

- Jamis
This topic is locked and can not be replied to.