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

.bash-profile #23

Open
maduhaime opened this issue Aug 4, 2014 · 28 comments
Open

.bash-profile #23

maduhaime opened this issue Aug 4, 2014 · 28 comments
Labels

Comments

@maduhaime
Copy link

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

@johnhidey
Copy link
Owner

@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.

@maduhaime
Copy link
Author

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.

@johnhidey
Copy link
Owner

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.

@maduhaime
Copy link
Author

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

@TheBenji
Copy link

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.

@johnhidey
Copy link
Owner

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
Copy link
Owner

@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 johnhidey removed the bug label Dec 14, 2014
@johnhidey
Copy link
Owner

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.

@maduhaime
Copy link
Author

Not working under Mac with 0.7...

@johnhidey
Copy link
Owner

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 johnhidey reopened this Dec 16, 2014
@johnhidey
Copy link
Owner

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 johnhidey added bug and removed duplicate labels Dec 16, 2014
@maduhaime
Copy link
Author

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!

@johnhidey
Copy link
Owner

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

@maduhaime
Copy link
Author

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
Copy link
Author

Thanks for your time!

@johnhidey
Copy link
Owner

@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
Copy link
Owner

@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
Copy link
Owner

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

@maduhaime
Copy link
Author

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

On Dec 17, 2014, at 05:34, John Hidey notifications@github.com 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 #23 (comment).

@johnhidey
Copy link
Owner

@maduhaime Have an update on this yet?

@maduhaime
Copy link
Author

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 notifications@github.com a écrit :

@maduhaime Have an update on this yet?


Reply to this email directly or view it on GitHub.

@johnhidey
Copy link
Owner

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

@ve2caz
Copy link

ve2caz commented Mar 21, 2015

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.

@lonkelle
Copy link

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."

@derwaldgeist
Copy link

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

@esko22
Copy link

esko22 commented Sep 20, 2015

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

@lightweightadventures
Copy link

Same as esko -- this works fine now.

@kohashi
Copy link

kohashi commented Mar 30, 2016

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

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

9 participants