lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]



Hi Duck, hope the antipodes are treating you well

Christmas and New Year are back in summer where they belong.

As for the builtin io.popen. It works fine in console programs,
Unix/Windows. But it doesn't work _at all_ under Windows
non-console

Yes, MSDN itself shamelessly admits that:

/If used in a Windows program, the _popen function returns an invalid file /pointer that will cause the program to hang indefinitely. _popen works /properly in a Console application.

and io.popen() uses (unsurprisingly) _popen() when built under Windows. You can selectively suppress this by undefining LUA_USE_POPEN in luaconf.h, which would be a simple way to prevent its use when building Lua for embedding in Windows GUI app you know is Windows GUI based.

/To create a Windows application that redirects input and output, see /Creating a Child Process with Redirected Input and Output in the Platform /SDK. (Gratuitously complicated and _very_ slightly non-ANSI C code /included :-)

I had to laugh at the way MSDN describes a GUI binary as a Windows app, and a console binary as a Console app, as though it weren't pure enough to be considered a Windows binary at all, even though it runs on Windows :-)