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

classic Classic list List threaded Threaded
19 messages Options
Reply | Threaded
Open this post in threaded view
|

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

Sannyasin Brahmanathaswami

I have a stack with a field that contains a shell script:

cd /Users/Brahmanathaswami/Documents/media-books/_hap-epub-export-tool
node index.js --epubFile ###epubPath### -e -i ###OutputDirectory###

I replace the strings with real values.

Second line looks like this:

node index.js --epubFile /Users/Brahmanathaswami/Documents/media-books/aging-gracefully_ei/aging-gracefully_ei.epub -e -i aging-gracefully_ei

This runs just fine from terminal, but when I pass it to tShell and run

Put shell(tShell) # I get this back.

/bin/sh: line 2: node: command not found


What am I doing wrong?

Brahmanathaswami


_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

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

Jerry Jensen-2
Which shell runs from the command line? Maybe not /bin/sh

> On May 8, 2016, at 1:20 PM, Sannyasin Brahmanathaswami <[hidden email]> wrote:
>
>
> I have a stack with a field that contains a shell script:
>
> cd /Users/Brahmanathaswami/Documents/media-books/_hap-epub-export-tool
> node index.js --epubFile ###epubPath### -e -i ###OutputDirectory###
>
> I replace the strings with real values.
>
> Second line looks like this:
>
> node index.js --epubFile /Users/Brahmanathaswami/Documents/media-books/aging-gracefully_ei/aging-gracefully_ei.epub -e -i aging-gracefully_ei
>
> This runs just fine from terminal, but when I pass it to tShell and run
>
> Put shell(tShell) # I get this back.
>
> /bin/sh: line 2: node: command not found
>
>
> What am I doing wrong?
>
> Brahmanathaswami
>
>
> _______________________________________________
> use-livecode mailing list
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode


_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

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

Jerry Jensen-2
Never mind, the msg box does run /bin/sh
Sorry for the bandwidth waste

> On May 8, 2016, at 1:46 PM, Jerry Jensen <[hidden email]> wrote:
>
> Which shell runs from the command line? Maybe not /bin/sh
>
>> On May 8, 2016, at 1:20 PM, Sannyasin Brahmanathaswami <[hidden email]> wrote:
>>
>>
>> I have a stack with a field that contains a shell script:
>>
>> cd /Users/Brahmanathaswami/Documents/media-books/_hap-epub-export-tool
>> node index.js --epubFile ###epubPath### -e -i ###OutputDirectory###
>>
>> I replace the strings with real values.
>>
>> Second line looks like this:
>>
>> node index.js --epubFile /Users/Brahmanathaswami/Documents/media-books/aging-gracefully_ei/aging-gracefully_ei.epub -e -i aging-gracefully_ei
>>
>> This runs just fine from terminal, but when I pass it to tShell and run
>>
>> Put shell(tShell) # I get this back.
>>
>> /bin/sh: line 2: node: command not found
>>
>>
>> What am I doing wrong?
>>
>> Brahmanathaswami
>>
>>
>> _______________________________________________
>> use-livecode mailing list
>> [hidden email]
>> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
>> http://lists.runrev.com/mailman/listinfo/use-livecode
>
>
> _______________________________________________
> use-livecode mailing list
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode


_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

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

Sannyasin Brahmanathaswami
Aloha:

cd /Users/Brahmanathaswami/Documents/media-books/_hap-epub-export-tool

ls

runs just fine...so /bin/sh

is delivering from LC "no problemo"

It's something about LC now knowing that I have node installed when invoked via shell

BR



On 5/8/16, 10:51 AM, "use-livecode on behalf of Jerry Jensen" <[hidden email] on behalf of [hidden email]> wrote:

>Never mind, the msg box does run /bin/sh
_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

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

Warren Samples
On 05/08/2016 04:07 PM, Sannyasin Brahmanathaswami wrote:
> It's something about LC now knowing that I have node installed when invoked via shell
>
> BR
>

Compare what you get when you run 'echo $PATH' in a terminal to what you
get when you run it in LiveCode using shell(). Make sure the directory
that contains whatever executable you might be running is installed in
or linked in a directory that is in the $PATH returned by LiveCode's
shell function. It would appear that it isn't in this case. You can
further test by running 'which [command]' in a terminal and see if it's
located in one of the directories that 'put shell("echo $PATH")'
returns. It's not about which shell (executable), it's about the env and
the $PATH.

Good luck!

Warren

_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

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

[-hh]
On Mac, especially 10.11.x (with SIP enabled) , most user
installations MUST go into "/usr/local/bin".
So adjust the LC global $PATH to shell's $PATH. Minimal:

on preopenstack
  put "/usr/local/bin:" before $PATH
  -- put ":/usr/local/bin" after $PATH
end preopenstack

The second line prefers "system installations" before "user installations".

[Is it worth an enhancement request to add "/usr/local/bin" by default
to LC's global $PATH on Mac?]
Reply | Threaded
Open this post in threaded view
|

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

mwieder
On 05/08/2016 03:06 PM, [-hh] wrote:

> On Mac, especially 10.11.x (with SIP enabled) , most user
> installations MUST go into "/usr/local/bin".
> So adjust the LC global $PATH to shell's $PATH. Minimal:
>
> on preopenstack
>    put "/usr/local/bin:" before $PATH
>    -- put ":/usr/local/bin" after $PATH
> end preopenstack
>
> The second line prefers "system installations" before "user installations".
>
> [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
  [hidden email]

_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
--
 Mark Wieder
 ahsoftware@gmail.com
Reply | Threaded
Open this post in threaded view
|

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

Sannyasin Brahmanathaswami
In reply to this post by Warren Samples
@ Warren: Bingo:

# in terminal:

$ echo $PATH
/usr/local/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin

# from LC

put shell ("echo $PATH")
/usr/bin:/bin:/usr/sbin:/sbin

# checking which

$ which node
/usr/local/bin/node

@HH I think I will stick with Mark's recommendation to specify the absolute path.. this works

cd /Users/Brahmanathaswami/Documents/media-books/_hap-epub-export-tool
/usr/local/bin/node index.js --epubFile ###epubPath### -e -i ###OutputDirectory###


Awesome, now with a some keys on the remote server and a little scp I am cooking with gas..

Mahalo!

BR

p.s. HH Wrote:  Is it worth an enhancement request to add "/usr/local/bin" by default
to LC's global $PATH on Mac?

BR: yes indeed... not sure bug ID 10569 is the place for it I though as the scope of Mark's (Waddington) idea there seems a bit different to me.. though I am not an expert...




On 5/8/16, 12:22 PM, "use-livecode on behalf of Warren Samples" <[hidden email] on behalf of [hidden email]> wrote:

>Compare what you get when you run 'echo $PATH' in a terminal to what you
>get when you run it in LiveCode using shell()
_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

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

[-hh]
In reply to this post by mwieder
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
  [hidden email]
Reply | Threaded
Open this post in threaded view
|

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

Mark Waddingham-2
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] <[hidden email]> 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
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode

_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

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

Mark Waddingham-2
In reply to this post by mwieder
Yes - I think a 'login' type shell option would help here. (Which, if I recall correctly, causes the standard terminal setup scripts to run).

The reason the action of shell is to not use a login shell is because otherwise env vars you might want to pass to your new process might get clobbered by user settings which is (in general) probably not what you want.

For example if you set PATH temporarily to a specific folder to control the environment of your new process, it might be overridden by user settings causing breakage the other way. (Particularly if you need to use your own env vars which happened to also be set - for other reasons - in a user's shell environment).

Sent from my iPhone

> On 9 May 2016, at 00:11, Mark Wieder <[hidden email]> wrote:
>
>> On 05/08/2016 03:06 PM, [-hh] wrote:
>> On Mac, especially 10.11.x (with SIP enabled) , most user
>> installations MUST go into "/usr/local/bin".
>> So adjust the LC global $PATH to shell's $PATH. Minimal:
>>
>> on preopenstack
>>   put "/usr/local/bin:" before $PATH
>>   -- put ":/usr/local/bin" after $PATH
>> end preopenstack
>>
>> The second line prefers "system installations" before "user installations".
>>
>> [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
> [hidden email]
>
> _______________________________________________
> use-livecode mailing list
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode

_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

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

David Bovill-3
Yes - here is the handler you need:

command bash_AddSystemPathsToPATH

> if the platform = "MacOS" then -- and it is recent ???
> put url "file:/etc/paths" into systemPaths
> put token 1 to -1 of systemPaths into systemPathArray
> put $PATH into revPATH
> replace ":" with CR in revPATH
> put systemPathArray & CR & revPATH into combinedPath
> sort combinedPath
> put token 1 to -1 of combinedPath into combinedPath
> split combinedPath with CR and ":"
> put keys (combinedPath) into newPathIndex
> replace CR with ":" in newPathIndex
> put newPathIndex into $PATH
> end if
> return $PATH
> end bash_AddSystemPathsToPATH


Essentially there is a nice easy list of paths on modern OSX systems here:

   -  /etc/paths

What is happening is that unfortunately the $PATH that Livecode sees is not
the same as your users shell - due to varied ways that users systems are
configured.

You want to use the above script on startup to automatically configure your
$PATH in Livecode for things like "brew" and npm.


On 9 May 2016 at 19:09, Mark Waddingham <[hidden email]> wrote:

> Yes - I think a 'login' type shell option would help here. (Which, if I
> recall correctly, causes the standard terminal setup scripts to run).
>
> The reason the action of shell is to not use a login shell is because
> otherwise env vars you might want to pass to your new process might get
> clobbered by user settings which is (in general) probably not what you want.
>
> For example if you set PATH temporarily to a specific folder to control
> the environment of your new process, it might be overridden by user
> settings causing breakage the other way. (Particularly if you need to use
> your own env vars which happened to also be set - for other reasons - in a
> user's shell environment).
>
> Sent from my iPhone
>
> > On 9 May 2016, at 00:11, Mark Wieder <[hidden email]> wrote:
> >
> >> On 05/08/2016 03:06 PM, [-hh] wrote:
> >> On Mac, especially 10.11.x (with SIP enabled) , most user
> >> installations MUST go into "/usr/local/bin".
> >> So adjust the LC global $PATH to shell's $PATH. Minimal:
> >>
> >> on preopenstack
> >>   put "/usr/local/bin:" before $PATH
> >>   -- put ":/usr/local/bin" after $PATH
> >> end preopenstack
> >>
> >> The second line prefers "system installations" before "user
> installations".
> >>
> >> [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
> > [hidden email]
> >
> > _______________________________________________
> > use-livecode mailing list
> > [hidden email]
> > Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> > http://lists.runrev.com/mailman/listinfo/use-livecode
>
> _______________________________________________
> use-livecode mailing list
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>
_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

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

[-hh]
David B. wrote
> Yes - here is the handler you need:

> command bash_AddSystemPathsToPATH
> if the platform = "MacOS" then -- and it is recent ???
> put url "file:/etc/paths" into systemPaths
> put token 1 to -1 of systemPaths into systemPathArray
> put $PATH into revPATH
> replace ":" with CR in revPATH
> put systemPathArray & CR & revPATH into combinedPath
> sort combinedPath
> put token 1 to -1 of combinedPath into combinedPath
> split combinedPath with CR and ":"
> put keys (combinedPath) into newPathIndex
> replace CR with ":" in newPathIndex
> put newPathIndex into $PATH
> end if
> return $PATH
> end bash_AddSystemPathsToPATH
> You want to use the above script on startup to automatically
> configure your $PATH in Livecode for things like "brew" and npm.

Clever script.
But who knows to which file Apple's launchctl writes environments vars?
And who knows which 'path-file' LC uses at startup for it's $PATH?

So I would like to propose *moreover* to ensure that /usr/local/bin
is added to $PATH ( I have here the paths:
/usr/local/bin/brew and /usr/local/bin/npm )
Reply | Threaded
Open this post in threaded view
|

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

David Bovill-3
Yes - the way i see this is a combination of tools that help, and manual.

So we have some scripts which check common places and find / suggest things
to add. Then we have the ability to customise and add our own by hand. We
save these to a preference file, and load them when we start Livecode. That
way it should sort of just work for most use cases, but you can always add
things by hand.

It's also a nice way to teach people where to find these things. The
interface can offer the option to open folders, and / or peak at files.


On 9 May 2016 at 22:01, [-hh] <[hidden email]> wrote:

> David B. wrote
> > Yes - here is the handler you need:
>
> > command bash_AddSystemPathsToPATH
> > if the platform = "MacOS" then -- and it is recent ???
> > put url "file:/etc/paths" into systemPaths
> > put token 1 to -1 of systemPaths into systemPathArray
> > put $PATH into revPATH
> > replace ":" with CR in revPATH
> > put systemPathArray & CR & revPATH into combinedPath
> > sort combinedPath
> > put token 1 to -1 of combinedPath into combinedPath
> > split combinedPath with CR and ":"
> > put keys (combinedPath) into newPathIndex
> > replace CR with ":" in newPathIndex
> > put newPathIndex into $PATH
> > end if
> > return $PATH
> > end bash_AddSystemPathsToPATH
> > You want to use the above script on startup to automatically
> > configure your $PATH in Livecode for things like "brew" and npm.
>
> Clever script.
> But who knows to which file Apple's launchctl writes environments vars?
> And who knows which 'path-file' LC uses at startup for it's $PATH?
>
> So I would like to propose *moreover* to ensure that /usr/local/bin
> is added to $PATH ( I have here the paths:
> /usr/local/bin/brew and /usr/local/bin/npm )
>
>
>
>
> --
> 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-tp4704464p4704487.html
> Sent from the Revolution - User mailing list archive at Nabble.com.
>
> _______________________________________________
> use-livecode mailing list
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>
_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

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

Mike Bonner
Try this:

set the shellcommand to "/bin/bash"
get shell("source ~/.bash_profile ; <yourcommands here> ")

This should do all the environment setting that is done when you open a
terminal so that hopefully paths will match.

To check it out, first echo $PATH without sourcing the .bash_profile and
you'll most likely get a teensy little path.

Then do it with get shell("source ~/.bash_profile; echo $PATH") and it
should match (hopefully) the path in the terminal. (don't forget to set the
shellcommand, though /bin/sh and bash are similar, so maybe it will work
fine without?)

Is there any way to get lc to process .bash_profile by default?  If not,
what shell startup script is run (if any?) by lc when using the default
shellcommand /bin/sh
_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

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

[-hh]
Mike B. worte:
> Try this:
> set the shellcommand to "/bin/bash"
> get shell("source ~/.bash_profile ; <yourcommands here> ")

You are right, of course. For one's own machine this is the
simplest. One could even vice versa write a full (temporary)
shell-profile before using shell.
But if you wish to know if a user has installed a 'default'
binary you wish to use at the 'default' place or elsewhere,
then this could fail.
I am for example nearly always working as root (that's the
only way to avoid silly errors) but never would allow others
to use my root shell.

> Is there any way to get lc to process .bash_profile by default?

Why not set $PATH or $PATH-additions in the preferences?
Reply | Threaded
Open this post in threaded view
|

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

Mike Bonner
Ah, I see. And thank you!  I now have a plugin that does a shell (source
blah blah echo $PATH) so that I always have my full terminal path available
to lc shell.  No extra/custom paths added yet, but it'll be nice to always
have the full path so I don't have to mess with absolute pathing (or
building the path in the shell every time)

Thanks for sharing!

On Mon, May 9, 2016 at 5:36 PM, [-hh] <[hidden email]> wrote:

> Mike B. worte:
> > Try this:
> > set the shellcommand to "/bin/bash"
> > get shell("source ~/.bash_profile ; <yourcommands here> ")
>
> You are right, of course. For one's own machine this is the
> simplest. One could even vice versa write a full (temporary)
> shell-profile before using shell.
> But if you wish to know if a user has installed a 'default'
> binary you wish to use at the 'default' place or elsewhere,
> then this could fail.
> I am for example nearly always working as root (that's the
> only way to avoid silly errors) but never would allow others
> to use my root shell.
>
> > Is there any way to get lc to process .bash_profile by default?
>
> Why not set $PATH or $PATH-additions in the preferences?
>
>
>
> --
> 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-tp4704464p4704490.html
> Sent from the Revolution - User mailing list archive at Nabble.com.
>
> _______________________________________________
> use-livecode mailing list
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>
_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

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

David Bovill-3
But on El Capitan you don't have a .bash_profile or .profile by default I
think? And put shell ("echo $PATH") does not fetch the users shell? Any
suggestions?

On 10 May 2016 at 02:02, Mike Bonner <[hidden email]> wrote:

> Ah, I see. And thank you!  I now have a plugin that does a shell (source
> blah blah echo $PATH) so that I always have my full terminal path available
> to lc shell.  No extra/custom paths added yet, but it'll be nice to always
> have the full path so I don't have to mess with absolute pathing (or
> building the path in the shell every time)
>
> Thanks for sharing!
>
> On Mon, May 9, 2016 at 5:36 PM, [-hh] <[hidden email]> wrote:
>
> > Mike B. worte:
> > > Try this:
> > > set the shellcommand to "/bin/bash"
> > > get shell("source ~/.bash_profile ; <yourcommands here> ")
> >
> > You are right, of course. For one's own machine this is the
> > simplest. One could even vice versa write a full (temporary)
> > shell-profile before using shell.
> > But if you wish to know if a user has installed a 'default'
> > binary you wish to use at the 'default' place or elsewhere,
> > then this could fail.
> > I am for example nearly always working as root (that's the
> > only way to avoid silly errors) but never would allow others
> > to use my root shell.
> >
> > > Is there any way to get lc to process .bash_profile by default?
> >
> > Why not set $PATH or $PATH-additions in the preferences?
> >
> >
> >
> > --
> > 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-tp4704464p4704490.html
> > Sent from the Revolution - User mailing list archive at Nabble.com.
> >
> > _______________________________________________
> > use-livecode mailing list
> > [hidden email]
> > Please visit this url to subscribe, unsubscribe and manage your
> > subscription preferences:
> > http://lists.runrev.com/mailman/listinfo/use-livecode
> >
> _______________________________________________
> use-livecode mailing list
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>
_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

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

Mike Bonner
I've been avoiding el capitan so far, but on my system, /etc/paths contains
the bare minimum paths.  /etc/profile adds /opt/local/bin and
/opt/local/sbin, then ~/.bash_profile tacks on a few more (like the path to
mysql and inferno, plus some adjustments made by macports (which appear to
be duplicates of the /opt paths)

Also just discovered "path_helper" which looks for files in /etc/paths.d
and adds paths from any files in there.  (there's one for X11 (Quartz)
another for git, and com.apple.server for the mac server app on my system.)

Nothin like spreading things around a bit..path_helper fires off from
/etc/profile

On Mon, May 9, 2016 at 7:56 PM, David Bovill <[hidden email]> wrote:

> But on El Capitan you don't have a .bash_profile or .profile by default I
> think? And put shell ("echo $PATH") does not fetch the users shell? Any
> suggestions?
>
> On 10 May 2016 at 02:02, Mike Bonner <[hidden email]> wrote:
>
> > Ah, I see. And thank you!  I now have a plugin that does a shell (source
> > blah blah echo $PATH) so that I always have my full terminal path
> available
> > to lc shell.  No extra/custom paths added yet, but it'll be nice to
> always
> > have the full path so I don't have to mess with absolute pathing (or
> > building the path in the shell every time)
> >
> > Thanks for sharing!
> >
> > On Mon, May 9, 2016 at 5:36 PM, [-hh] <[hidden email]> wrote:
> >
> > > Mike B. worte:
> > > > Try this:
> > > > set the shellcommand to "/bin/bash"
> > > > get shell("source ~/.bash_profile ; <yourcommands here> ")
> > >
> > > You are right, of course. For one's own machine this is the
> > > simplest. One could even vice versa write a full (temporary)
> > > shell-profile before using shell.
> > > But if you wish to know if a user has installed a 'default'
> > > binary you wish to use at the 'default' place or elsewhere,
> > > then this could fail.
> > > I am for example nearly always working as root (that's the
> > > only way to avoid silly errors) but never would allow others
> > > to use my root shell.
> > >
> > > > Is there any way to get lc to process .bash_profile by default?
> > >
> > > Why not set $PATH or $PATH-additions in the preferences?
> > >
> > >
> > >
> > > --
> > > 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-tp4704464p4704490.html
> > > Sent from the Revolution - User mailing list archive at Nabble.com.
> > >
> > > _______________________________________________
> > > use-livecode mailing list
> > > [hidden email]
> > > Please visit this url to subscribe, unsubscribe and manage your
> > > subscription preferences:
> > > http://lists.runrev.com/mailman/listinfo/use-livecode
> > >
> > _______________________________________________
> > use-livecode mailing list
> > [hidden email]
> > Please visit this url to subscribe, unsubscribe and manage your
> > subscription preferences:
> > http://lists.runrev.com/mailman/listinfo/use-livecode
> >
> _______________________________________________
> use-livecode mailing list
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>
_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode