Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

executing in login shell & with path #22

Closed
hankeypancake opened this issue Apr 16, 2014 · 1 comment
Closed

executing in login shell & with path #22

hankeypancake opened this issue Apr 16, 2014 · 1 comment
Labels

Comments

@hankeypancake
Copy link

I noticed my aliases and sourced scripts didn't work as expected (most notably nvm). I believe this is because commands is not executed in a login shell, so the .bashrc / .profile etc. is not applied.

I came up with a workaround though, executing with .sudo() and a user works, but then I cant use .with(), because when sudoing I'm ending up at the users home directory.

so then I needed to cd to the correct path before executing anything again, but now we've ended up with

remote.sudo('cd ~/www/mysite && npm install', {user:'myuser'});

for every command that I need to be executed with a login shell.

could this be done in the same manner as .with() ?

i.e.:

remote.login('myuser', function(){
    remote.with('cd ~/www/mysite', function(){
        remote.exec('npm install');
        ...
    });
});

also, i don't really know how you do .with() since we seem to use the same transport, does it get set through the rest of the flight? why not pass a new modified transport in as argument to the function (I might have missed something here).

like so:

remote.with('cd ~/www/mysite', function(withTransport){
     withTransport.exec('dostuff');
});

otherwise, why the need to pass a function?

@pstadler
Copy link
Owner

This is a problem indeed. I'll try to make with() work as expected in this case.

@pstadler pstadler added bug and removed bug labels Apr 22, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants