[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: io.popen(s, 'rb') ?
- From: Luiz Henrique de Figueiredo <lhf@...>
- Date: Sat, 2 Oct 2010 08:23:09 -0300
> local pipe = assert(io.popen('ls', 'r'))
> succeeds, but
> local pipe = assert(io.popen('ls', 'rb'))
> lua: t:2: ls: Invalid argument
> (It doesn't complain about 'rb', it complains about 'ls' !?)
The message "Invalid argument" is coming from the OS.
> The manpage I found says:
> The mode string can also have a 'b' at the end, which is needed
> in some systems to open the file in binary mode. This string
> is exactly what is used in the standard C function fopen.
Not what POSIX says: http://www.opengroup.org/onlinepubs/009695399/functions/popen.html