[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: io.popen and binary read mode on Windows
- From: Roberto Ierusalimschy <roberto@...>
- Date: Mon, 30 Nov 2020 09:59:34 -0300
> > io.popen('lua.exe -e"print(string.char(49,26,50))"',
> stdin:1: bad argument #2 to 'popen' (invalid mode)
> Why does Lua 5.4 not allow me to read verbatim output of an external
> Windows process?
According to the official documentation :
. The character string mode specifies the type of access requested,
Access mode Description
"r" The calling process can read the spawned command's
standard output using the returned stream.
"w" The calling process can write to the spawned command's
standard input using the returned stream.
"b" Open in binary mode.
"t" Open in text mode.
Note that the string "rb" is not in the list. :-)
More seriously, we really don't know the meaning of the above
documentation, and therefore we don't know what to implement.
(Maybe they mean "[rw][bt]?", but that is just speculation.)
For now, you can compile Lua defining l_checkmode(x) as 1 or
whatever you seem fit.