Re: [NTG-context] check installed program using Lua

2021-11-02 Thread Pablo Rodriguez via ntg-context
On 11/1/21 5:13 PM, Hans Hagen via ntg-context wrote: > On 11/1/2021 2:26 PM, Pablo Rodriguez via ntg-context wrote: >> [...] >> Is there a way to wrap os.exec() in the sample so that it only runs if >> "dir" is available? >> >> I know that os.name would be an option here, but not in my real world

Re: [NTG-context] check installed program using Lua

2021-11-02 Thread Pablo Rodriguez via ntg-context
On 11/1/21 3:10 PM, Taco Hoekwater via ntg-context wrote: >> [...] >> Is there a way to wrap os.exec() in the sample so that it only runs if >> "dir" is available? > > if os.which(‘dir’) then > ... > end > > But note that os.which() may be unreliable in various cases (like it > will fail for shel

Re: [NTG-context] check installed program using Lua

2021-11-01 Thread Hans Hagen via ntg-context
On 11/1/2021 2:26 PM, Pablo Rodriguez via ntg-context wrote: Dear list, is there a way if a program is installed on the computer using Lua. I have the following sample: \starttext \startluacode filename = tex.jobname .. ".pdf" os.exec("dir " .. filename) \stopluacode \stoptex

Re: [NTG-context] check installed program using Lua

2021-11-01 Thread Taco Hoekwater via ntg-context
> On 1 Nov 2021, at 14:26, Pablo Rodriguez via ntg-context > wrote: > > Dear list, > > is there a way if a program is installed on the computer using Lua. > > I have the following sample: > > \starttext > \startluacode > filename = tex.jobname .. ".pdf" > os.exec("dir " .. filename) >

[NTG-context] check installed program using Lua

2021-11-01 Thread Pablo Rodriguez via ntg-context
Dear list, is there a way if a program is installed on the computer using Lua. I have the following sample: \starttext \startluacode filename = tex.jobname .. ".pdf" os.exec("dir " .. filename) \stopluacode \stoptext Is there a way to wrap os.exec() in the sample so that it only run