On Sat, Dec 5, 2015 at 10:51 PM, David Carlisle <[email protected]>
wrote:

> On 5 December 2015 at 21:17, luigi scarso <[email protected]> wrote:
> >
> >
> > On Sat, Dec 5, 2015 at 6:51 PM, David Carlisle <[email protected]>
> > wrote:
>
> >
> > try
> >
> > \directlua{print('os.execute():|',os.execute(),'|')}
> > \bye
> >
> > with  also
> > --shell-restricted
> > --no-shell-escape
> >
> > It should be ok.
> >
> >
> >
> > --
> > luigi
>
>
> Oh thanks!
>
> Hmm so os.execute with empty argument doesn't call the shell and just
> returns 0,1 or 2?
>
> I have to ask, could I have deduced that from the manual?;-)
>



The current code is

static int os_execute(lua_State * L)
{
    int allow = 0;
    int ret = 1;
    char *safecmd = NULL;
    char *cmdname = NULL;
    const char *cmd = luaL_optstring(L, 1, NULL);

    if (cmd == NULL) { /* pretend we are \.{\\pdfshellescape} */
        if (shellenabledp <= 0) {
            lua_pushinteger(L, 0);
        } else if (restrictedshell == 0) {
            lua_pushinteger(L, 1);
        } else {
            lua_pushinteger(L, 2);
        }
        return 1;
    }

:
}

but I'm not sure that this will be the final form --- maybe for this reason
it  is still to be documented.


-- 
luigi

Reply via email to