[code] [textadept] Environment vars on OS X

From: Robert Gieseke <rob.g.att.web.de>
Date: Sun, 24 Jan 2016 21:55:28 +0100


as discussed recently[1] I did look a bit into whether it's possible to
simplify getting the environment variables right on OS X. The problem is
that when launched from the Finder, Dock, Spotlight etc. Textadept does
not inherit/use environment variables one normally has set in a terminal
session. When launched from there (with a `ta` script) everything is
fine. Currently Textadept on OS X runs a script `osx_env.sh` in which
environment variables like `PATH` can be set.

Since `spawn` has an `env` parameter it might be possible to set this
from within Textadept.

I looked a bit what other apps on OS X are currently doing, there exist
a few solutions[2][3] but there are differences between OS versions and
it's not trivial to get the right environment if one uses a non-standard
shell like `zsh` or `fish` (as I do). So if the `PATH` is not set for
`bash`, only in `fish` these approaches might fail as well.

I couldn't find a way to get something working in this manner.

It might be an option to have a `OSX_ENV` table set in `init.lua` which
would be set for `spawn` calls.
With the current way `spawn`[4] is defined as overwriting the
environment completely it might be confusing to have a special way on OS X.

A reliable way to detect whether Textadept has been started not from a
terminal appears to compare the path to the default

Any thoughts, experiences, ideas on this?
We might of course keep things as they are as the script approach works
(again) ...


[1]: http://foicica.com/lists/code/201601/2927.html
[2]: https://github.com/int3h/SublimeFixMacPath
[3]: https://github.com/atom-community/environment
[4]: http://foicica.com/textadept/api.html#spawn

You are subscribed to code.att.foicica.com.
To change subscription settings, send an e-mail to code+help.att.foicica.com.
To unsubscribe, send an e-mail to code+unsubscribe.att.foicica.com.
Received on Sun 24 Jan 2016 - 15:55:28 EST

This archive was generated by hypermail 2.2.0 : Mon 25 Jan 2016 - 06:31:02 EST