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

Subshell problems #32

Closed
roalddevries opened this issue Jan 6, 2012 · 13 comments
Closed

Subshell problems #32

roalddevries opened this issue Jan 6, 2012 · 13 comments

Comments

@roalddevries
Copy link

I'm trying to install coffee-script from a makefile, something like this:

./nave.sh use 0.6.5 && npm install coffee-script

That doesn't work, because nave creates a subshell; moreover, if I install the package from inside het nave-environment, and exit the subshell, this doesn't work (which is a problem for the web framework I use --- Django):

node_modules/.bin/coffee
env: node: No such file or directory

In virtualenv, the following (imaginary) would work:

virtualenv/bin/coffee

Is there a reason or a cause that this is not supported by nave (or is it supported, but can't I find it)? Or should we actually try and solve this?

@isaacs
Copy link
Owner

isaacs commented Jan 6, 2012

You'd have to enter the subshell and THEN do the thing in there. When you exit, you're not in the subshell any more, and might not even have node (or that version of node) in your PATH any longer. That's why you're getting the node: No such file or directory error.

Does this do what you want?

./nave.sh use 0.6.5 npm install coffee-script
./nave.sh use 0.6.5 node_modules/.bin/coffee

It wouldn't be too hard to add support for passing more than just one command to the nave use statement.

@isaacs isaacs closed this as completed Jan 6, 2012
@roalddevries
Copy link
Author

It does exactly what I want! Thanks for your reply, and sorry for the non-issue.

@isaacs
Copy link
Owner

isaacs commented Jan 7, 2012

No problem. If you feel that the docs or API could have made this more obvious, a patch would be welcome.

@roalddevries
Copy link
Author

Actually, it doesn't do exactly what I want; if I do

$ ./nave.sh use 0.6.5 node_modules/.bin/coffee -cs < test.coffee | head -1

I get

already using 0.6.5

... if I'm already using it; this is a problem for my script that doesn't know whether it is already using it. Can I suppress this message? Shouldn't it go to stderr?

@isaacs
Copy link
Owner

isaacs commented Jan 14, 2012

Oh, yeah, that's ugly. Should be printing to stderr.

Wanna send a pull req? I think there's an echo_err function already somewhere.

@welwood08
Copy link
Contributor

Hm, does it even need to say "already using" when the command is "use"?

@isaacs isaacs reopened this Jan 15, 2012
@isaacs isaacs closed this as completed in 530e86f Jan 15, 2012
@isaacs
Copy link
Owner

isaacs commented Jan 15, 2012

@welwood08 Well, so that's a bit tricky, actually... Should it create another nested subshell if it's already in a subshell where NAVE=0.6.5? If not, I'd like to have some kind of indication that it's not doing that.

@welwood08
Copy link
Contributor

Ah yes, nevermind me - I was actually thinking of the "using x" message which seemed a bit verbose when that's what it was instructed to do (at one point I even had the idea to, instead of echoing node version, prefix/modify the shell prompt with it and nave level, but then the sensible, lazy me arrived). Anyway, glad it's going on stderr at least.

@isaacs
Copy link
Owner

isaacs commented Jan 15, 2012

@welwood08
Copy link
Contributor

That does indeed look like what I was thinking of but never got round to learning, thanks.

@roalddevries
Copy link
Author

I got a new error with the same use case; as of version 2.7, if I do

nave.sh use 0.6.5 node_modules/.bin/coffee

I get in response

Already installed: 0.6.5
using 0.6.5
/usr/bin/env: node: No such file or directory

@isaacs
Copy link
Owner

isaacs commented Feb 28, 2012

Aha, reproducing. Got a fix, landing now.

@isaacs
Copy link
Owner

isaacs commented Feb 28, 2012

Ok, fixed on 0.2.10

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants