Running Node (or any unix cmd line program) from Shell from a LC Stack

Mark Waddingham mark at livecode.com
Mon May 9 20:03:01 CEST 2016


LiveCode will inherit the path env variable given to it by the environment which launched it.

If you have access to exes from Terminal in something like /usr/local/bin but not from apps launched from the desktop then this suggests the local bin path is only configured in your bashrc rather than truly globally.

I'm pretty sure there is a way to configure global env vars on Mac although not sure where it would be these days...

Sent from my iPhone

> On 9 May 2016, at 02:23, [-hh] <hh at hh.on-rev.com> wrote:
> 
> It's sadly a big "not". I've never seen anything else than
> 
> /usr/bin:/bin:/usr/sbin:/sbin
> 
> in LC's $PATH at startup.
> 
> But the $PATH of *any* shell on 10.11.x (SIP enabled)
> contains /usr/local/bin [because SIP doesn't allow to
> install in /usr/bin].
> 
> Everybody could use Warren's comparison from above
> on his Mac for that.
> 
> Is it possible, that LC's $PATH is simply set and not
> been asked from the OS?
> 
> The following works for me.
> 
> function getPath p
>  set itemdel to colon
>  if "/usr/local/bin" is not among the items of $PATH
>  then put "/usr/local/bin:" before $PATH
>  set itemdel to comma
>  return shell("which" && p)
> end getPath
> 
> 
> mwieder wrote
>>> Is it worth an enhancement request to add "/usr/local/bin" by default
>>> to LC's global $PATH on Mac?
>> 
>> Possibly. Maybe an addendum to 
>> http://quality.livecode.com/show_bug.cgi?id=10569, although that's four 
>> years old now (wow - even Mark Waddingham's enhancement requests don't 
>> get any love).
>> 
>> I think the documentation on the shell() command needs some work to 
>> cover things like this (hint for anyone who wants to take this task on). 
>> The shell you get when you invoke the shell() command is a bit the same 
>> as the shell you get in the terminal prompt and a bit not. You're 
>> running into one of the nots.
>> 
>> Another way around this is to specify the absolute path to node instead 
>> of letting the OS get it from the PATH env variable. You could also 
>> change the PATh setting in one of the config rc files... I'm not at my 
>> Mac right now, so I can't tell you which one.
>> 
>> -- 
>>  Mark Wieder
> 
>> ahsoftware@
> 
> 
> 
> 
> 
> --
> View this message in context: http://runtime-revolution.278305.n4.nabble.com/Running-Node-or-any-unix-cmd-line-program-from-Shell-from-a-LC-Stack-tp4704464p4704472.html
> Sent from the Revolution - User mailing list archive at Nabble.com.
> 
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode



More information about the use-livecode mailing list