[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: io.popen binary write compatibility
- From: Enrico Colombini <erix@...>
- Date: Wed, 24 Sep 2014 23:05:04 +0200
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