hdy.brackets-shell icon indicating copy to clipboard operation
hdy.brackets-shell copied to clipboard

.bash-profile

Open maduhaime opened this issue 11 years ago • 28 comments

I'm trying to use shell to run ruby and rails command (using rbenv on Mac) but the .bash_profile is probably not loaded when your plugin is activated.

I have tried to loaded manually using "source ~/.bash_profile" but it's not working. Any clue on how to make it work?

Thanks

maduhaime avatar Aug 04 '14 01:08 maduhaime

@maduhaime I am pretty sure this is the same as issue #22
I'm not a mac guy at all but I'm looking into this as to why the mac environment path isn't being loaded.

Also haven't had much time to put into this lately and I have quite a few changes that I need to finish up here soon and get committed. I'll try to touch base with you here sometime next week and give you a quick status update on where I stand with this.

johnhidey avatar Aug 05 '14 23:08 johnhidey

Yes John, it is the same issue. This is a clue. Find with the help of Google...

Excerpt from man bash:

When bash is invoked as an interactive login shell, or as a non-interactive shell with the --login option, it first reads and executes commands from the file /etc/profile, if that file exists. After reading that file, it looks for ~/.bash_profile, ~/.bash_login, and ~/.profile, in that order, and reads and executes commands from the first one that exists and is readable.

su on the other hand also does not start a login shell by default, you have to tell it to do so by using the --login option.

It is probably related to the way Node implement child_process exec.

maduhaime avatar Aug 06 '14 00:08 maduhaime

Thanks for the help with the research. That will be helpful. Hopefully I'll have a chance here soon to give it a try. Thanks again.

johnhidey avatar Aug 06 '14 00:08 johnhidey

Node.js is the next things on my learning list... Maybe one day I'll come back with a pull request!

maduhaime avatar Aug 06 '14 00:08 maduhaime

For *unix: May want to try to spawn (rather than exec) an actual terminal and just pipe all the input in there (and deal with the output streams similar as you do atm). So that you're literally just a wrapper, would have the advantage that you can do everything like in a "real" terminal.

Not sure that makes sense but might be worth looking into.

TheBenji avatar Aug 27 '14 14:08 TheBenji

Sorry everyone, I was on vacation for 2 weeks and then came back to a pile of work at my day job. Hoping to get a new release out this weekend. Have already been looking into making the switch to use spawn instead of exec.

johnhidey avatar Sep 16 '14 15:09 johnhidey

@maduhaime . The shell should now be picking up your bash profile. I do not have a mac to test this but if you would verify this is fix is v0.0.7 I would appreciate it and then I can mark this closed.

johnhidey avatar Dec 13 '14 16:12 johnhidey

I finally have this working. I have verified this on an installation of Ubuntu 14 x86. All worked worked great. There may be an issue with Linux only returning LF for EOL. If so, please create a new issue for this. Should you have any issues, please let me know and I'll see if I can address them.

johnhidey avatar Dec 16 '14 00:12 johnhidey

Not working under Mac with 0.7...

maduhaime avatar Dec 16 '14 00:12 maduhaime

What shell does the Mac use? I'm making the assumption for this push that the shell is located at /bin/sh .. in future versions I'm going to be giving you the ability to specify the shell to use.

johnhidey avatar Dec 16 '14 00:12 johnhidey

What version of the extension are you running? I just release v0.0.9 which is the version that addresses this bug. Hopefully you're running on v0.0.8 and need to update.

johnhidey avatar Dec 16 '14 00:12 johnhidey

I'm now with 0.0.9. Same thing. This is what I found :

(posted in 2010) http://support.apple.com/kb/ta27005

(posted in 2014) https://developer.apple.com/library/mac/documentation/OpenSource/Conceptual/ShellScripting/BeforeYouBegin/BeforeYouBegin.html#//apple_ref/doc/uid/TP40004268-CH1-SW1

Sorry. Cannot help you tonight. Must help my wife!

maduhaime avatar Dec 16 '14 01:12 maduhaime

Totally understand. I'm going to have to bring up a Hackintosh for testing. That is how I ended up solving the Linux side of things. This working blind isn't any good. Thanks for the links, I'll be looking into it as soon as I can

johnhidey avatar Dec 16 '14 01:12 johnhidey

http://unix.stackexchange.com/questions/43499/difference-between-echo-shell-and-which-bash

On My Mac :

"echo $SHELL" output /bin/bash "which bash" also output /bin/bash "type bash" also output /bin/bash "echo $0" output -bash

maduhaime avatar Dec 16 '14 01:12 maduhaime

Thanks for your time!

maduhaime avatar Dec 16 '14 01:12 maduhaime

@maduhaime I believe I have a fix but before push it out to the masses I would like to do some testing with it. Would you be interested in helping test this fix? If so, let me know. Thanks ahead of time.

johnhidey avatar Dec 16 '14 02:12 johnhidey

@maduhaime I went ahead and created release v0.0.10 anyway since I felt the added feature would be appreciated by the *nix users.
Now for your issue you should try this. I have defaulted the shell in *nix platforms to be '/bin/sh' which is set on the new hdy.brackets-shell.shell preference. You'll need to view your brackets preferences file and update this setting to point to your shell. Based on your previous response, you should set it to be '/bin/bash' Hope this works for you. Keep me up to date.

johnhidey avatar Dec 16 '14 23:12 johnhidey

@maduhaime Is this issue still open? Does the latest version giving you the ability to specify the shell to use resolve you issue?

johnhidey avatar Dec 17 '14 10:12 johnhidey

I was not home yesterday. I will test it today!

On Dec 17, 2014, at 05:34, John Hidey [email protected] wrote:

@maduhaime https://github.com/maduhaime Is this issue still open? Does the latest version giving you the ability to specify the shell to use resolve you issue?

— Reply to this email directly or view it on GitHub https://github.com/johnhidey/hdy.brackets-shell/issues/23#issuecomment-67304381.

maduhaime avatar Dec 17 '14 15:12 maduhaime

@maduhaime Have an update on this yet?

johnhidey avatar Dec 19 '14 00:12 johnhidey

Yes. brackets.json configs worked perfectly. But I'm still unable to load bash_profile. even with source ~/.bash_profile

Marc-Antoine Duhaime iPhone : 514 531-1323

Le 2014-12-18 à 19:36, John Hidey [email protected] a écrit :

@maduhaime Have an update on this yet?

— Reply to this email directly or view it on GitHub.

maduhaime avatar Dec 19 '14 01:12 maduhaime

Went attempting to load your bash_profile do you receive a /bin/bash: /home/username/.bash_profile: Permission denied

johnhidey avatar Dec 19 '14 11:12 johnhidey

Since the last posted question doesn't have an answer and I'm fighting with the same problem I decided to contribute some observations. Manually sourcing the file does not produce errors. To try and get further I decided to manually export a variable to see if it persisted.

This is what the environment looks like after opening the shell:

SHELL=/bin/bash TMPDIR= USER= SSH_AUTH_SOCK=<> PATH=/usr/bin:/bin:/usr/sbin:/sbin PWD= SHLVL=1 HOME=/Users/ LOGNAME= DISPLAY= _=/usr/bin/env

What I did:

export PKG_CONFIG_PATH=/usr/X11/lib/pkgconfig

I was expecting to see this variable in the environment but executing env gave me back the same as above.

Afterwards I double checked the settings for bash and the shell that was running was in fact bash using the pid.

Interesting problem. I would love to get this resolved as it would speed up my work since I could run tests from within the editor.

ve2caz avatar Mar 21 '15 15:03 ve2caz

I'm experiencing this exact same problem, I can run my local/bin commands manually - but that's cumbersome. I can't seem to add any new paths to the $PATH environment. I'll keep working on this, but I thought I'd let everyone know it doesn't work no matter which shell you're using "sh" or "bash."

lonkelle avatar Apr 30 '15 17:04 lonkelle

Same problem here with MacOS X Yosemite. Used the shell under Windows very often and was very satisfied with it. But under MacOS it is not usable, since the correct paths are not loaded from ~/.profile

derwaldgeist avatar Jun 21 '15 18:06 derwaldgeist

Was having the same issue on OS X but was able to fix it...

What I did:

  • Changed the config to use "/bin/bash"
  • After running echo $PATH in the shell window, it showed it was using "BASH RC"
  • Added "/usr/local/bin" to ~/.bashrc path

esko22 avatar Sep 20 '15 05:09 esko22

Same as esko -- this works fine now.

lightweightadventures avatar Dec 08 '15 18:12 lightweightadventures

Same as esko -- and thanks! I added export PATH=/usr/local/bin:$PATH to ~/.bashrc, and brackets-shell works fine!

kohashi avatar Mar 30 '16 11:03 kohashi