-
-
Notifications
You must be signed in to change notification settings - Fork 24
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
Different PATH with fixPath compared to $PATH in terminal? #3
Comments
No idea. I'll look into it. // @silverwind Any ideas? |
Hmm, a childProcess.execSync(process.env.SHELL + ' -c \'echo $PATH\'').toString().trim() edit: fixed quoting |
If you just log the result directly you get nothing (surprisingly). I checked out in debugger and saw the following: |
Try again, I forgot quotes around the -c arguments earlier. |
@erikmellum Just run it in the node repl: I have a feeling this might be that you have those $PATH additions exported in |
If we compare from the expected output from the actual, we can see it stops at /Users/guest. I am suspicious that there is some strange permissions on that folder that break it. The place that logic doesn't hold up, is the fact that this is a string. |
@sindresorhus good suggestion about executing in the repl. Secondly, you are correct. I only have the PATH exported in .zshrc. I will add the .zshenv file and update you with the results. |
I think @sindresorhus is on the right track. Though, incorrect usage of childProcess.execFileSync(process.env.SHELL, ['-i', '-c', 'echo $PATH']).toString().trim() |
You bet your sweet brilliant booty's it works. I can't thank you two enough. The best I can do is pay it forward to others as a thank you - which I will. In celebration here is the output from my app.
Thanks to you both @sindresorhus @silverwind |
Imho, this case should be handled by this module. Opened sindresorhus/shell-path#3 |
@sindresorhus I still get an ENOENT error when I spawn from my application on OS X. I have the PATH correctly set now with your help, and the folder I'm executing it in certainly exists. Any idea what sort of context could cause the error to still be thrown despite those two variables being set appropriately? |
@erikmellum What are you trying to spawn? Can you share some code? |
@sindresorhus The application is going to be an extension to the foundation-cli that lets you set up new project workspaces in a GUI environment (many designers have a hard time learning the command line - this reduces the barrier). So some example commands that work in electron-prebuilt, but not in the OS X package are:
I fix the process.env.PATH using the method above |
Probably related to you using |
Thanks for the information. I will follow up on that issue. Your help is much appreciated. |
@sindresorhus I am trying to locate an example where someone has successfully spawned off gulp the way I want to. The closest I could find in your awesome-electron repo was your repo gulp-app. The interesting thing is the method you use there (By joining dirname) works in electron-prebuilt for me, but does not produce stream output when bundled up as a package. The other method I used was putting gulp as the script for npm start. The problem here is that calling npm.commands.start does not allow access to a stream. I put in issues to nvm (to programmatically expose the bin folder) and for npm (to emit events when using npm programmatically so users can latch onto whenever data is produced on a stream), but I'm not holding my breath for those fixes. I doubt they will get implemented so I'm searching for a solution within my control. Do you know any projects that utilize node_modules that I can reverse engineer? I'm trying to document my problems / progress here: https://discuss.atom.io/t/not-possible-to-spawn-npm-modules-from-electron-package-in-os-x/18905 My hope is to come up with a good precedent so people can solve this more easily in the future. If I could get RVM to implement the shell path that would be most ideal I think. I'm up to do these patches myself if there is no other alternative. |
@sindresorhus SOLVED
OR
Fixes this issue. I'd recommend adding the launchctl code to fixPath. It should solve this issue for others automagically. |
Basically I execute
childProcess.execFileSync(process.env.SHELL, ['-c', 'echo $PATH']).toString().trim()
and get a different value than when I am in the terminal and I execute
/bin/zsh -c 'echo $PATH'
. Wondering if you had any idea as to why that might be?http://prntscr.com/7r86op
Thanks.
The text was updated successfully, but these errors were encountered: