+9
Build cmd has no environment (OSX)
Is it correct that a build script starts with nearly no environment on OSX? I would have assumed that my .profile would have been parsed before executing the cmd.
For now I had to run bash with --login to get it. Is there a better way to do this?
For now I had to run bash with --login to get it. Is there a better way to do this?
Служба підтримки клієнтів працює на UserEcho
Do you think that it's awkward to implement an optionally definable shell command (e.g. "bash --login") to use as a wrapper for all shell calls from the config files? This way one could choose (by configuration) to either run them isolated or from a specific point of view (e.g. virtualenv or a custom wrapper which loads a proper virtualenv or shell env according to path etc. - at least that's what I would want to brew for myself...).
If you're feeling keen, can you try editing Packages/Default/exec.py, line 25, add the shell=True parameter, and see if that works for you?
If so, I can easily add 'shell' as a parameter in .sublime-bulid files
An optional parameter shell=False|True would be good anyway for people who know what they do.
I've now added these lines before line 19 as an example:
arg_list_prefix = ['bash', '-l', '-c']
if arg_list_prefix:
from pipes import quote
arg_list = map(quote, arg_list)
arg_list = arg_list_prefix + [' '.join(arg_list)]
I would really like to define this arg_list_prefix in my configuration file.
settings = sublime.load_settings("Global.sublime-settings")
arg_list_prefix = settings.get("arg_list_prefix", [])
What I really need are per-project environment settings. These could be simply defined in the project file for now and via a GUI at some future date.
When using popen, these could be pushed into the "env" argument.
You could, of course, also have an option in the build definition: "execution_shell" = True or somesuch.
It covers bash and virtualenv but could be easily adopted to other languages as well.
I really hope that Jon brings something like my arg list wrapper into the core...
Also +1 for "project specific setting/env overwrites".
Build systems don't even have the environment defined in ~/.MacOSX/environment.plist — I have PATH=/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin there, but build systems run with PATH=/usr/bin:/bin:/usr/sbin:/sbin and make doesn't find my gettext tools in /usr/local/bin.
OSX 10.6.8, ST2 build 2139
I had no env variables defined when running CMD+B in sublime text. I created a link (sudo ln -s "/Applications/SublimeText2.app/Contents/SharedSupport/bin/subl" ~/bin/subl) as explained in the documentation.
Then when I run ST from the shell using subl &, CMD+B works fine and gets all that is defined in my .profile