lua-users home
lua-l archive

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


I may have noted a slight portability problem in io.popen.
Under Linux this works fine (Lua 5.2.3):

  local p = io.popen('cmd', 'w')

Under Windows (both Lua 5.2.0 and 5.3.0 alpha, in case it matters) the above line may output incorrect and/or extra data, probably because the pipe is opened in text mode. I have to use 'wb':

  local p = io.popen('cmd', 'wb')

However, 'wb' is not accepted under Linux (io.popen returns nil).
(my quick-and-dirty workaround: try 'wb'; if it fails, try 'w')

P.S. The manual only quotes 'r' and 'w', there is no mention of 'wb'.

--
  Enrico