lua-users home
lua-l archive

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


>   local pipe = assert(io.popen('ls', 'r'))
> succeeds, but
>   local pipe = assert(io.popen('ls', 'rb'))
> gives:
>   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