unicode-monkeypatch: use tostring() in io.open error handling

msg can be nil, which would previously error out when trying to print it.
This commit is contained in:
arch1t3cht 2023-07-31 23:41:43 +02:00
parent 58c0130d81
commit 47c923d4ed

View file

@ -100,7 +100,7 @@ function io.open(fname, mode)
local file = assert(orig_open("nul", "rb"))
if ffi.C._wfreopen(wfname, wmode, file) == nil then
local msg, errno = select(2, file:close())
return nil, fname .. ": " .. msg, errno
return nil, fname .. ": " .. tostring(msg), errno
end
return file