johnhidey / hdy.brackets-shell

Brackets extension which give you shell access for both Windows and *nix platforms.
MIT License
35 stars 9 forks source link

.bash-profile #23

Open maduhaime opened 10 years ago

maduhaime commented 10 years ago

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 commented 10 years ago

@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 commented 10 years ago

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 commented 10 years ago

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 commented 10 years ago

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

TheBenji commented 10 years ago

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 commented 10 years ago

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 commented 9 years ago

@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 commented 9 years ago

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 commented 9 years ago

Not working under Mac with 0.7...

johnhidey commented 9 years ago

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 commented 9 years ago

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.

maduhaime commented 9 years ago

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 commented 9 years ago

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 commented 9 years ago

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 commented 9 years ago

Thanks for your time!

johnhidey commented 9 years ago

@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 commented 9 years ago

@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 commented 9 years ago

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

maduhaime commented 9 years ago

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 https://github.com/johnhidey/hdy.brackets-shell/issues/23#issuecomment-67304381.

johnhidey commented 9 years ago

@maduhaime Have an update on this yet?

maduhaime commented 9 years ago

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 commented 9 years ago

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

ve2caz commented 9 years ago

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_AUTHSOCK=<> 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 commented 9 years ago

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 commented 9 years ago

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 commented 9 years ago

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

What I did:

lightweightadventures commented 8 years ago

Same as esko -- this works fine now.

kohashi commented 8 years ago

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