Fix error behavior.

This commit is contained in:
James Roseborough
2010-04-02 14:48:01 +00:00
parent 946503fc20
commit d903a85578
2 changed files with 14 additions and 6 deletions

View File

@@ -111,7 +111,11 @@ print( "a:read", ( a:read(7) ) )
print( "b:read", ( b:read(7) ) )
--]]
local pcall = function(...) return ( pcall(...) )end
local pcall = function(...)
local s,e = pcall(...)
if s then return s end
return s,e:match("closed")
end
print( 'a:close', pcall( a.close, a ) )
print( 'a:write', pcall( a.write, a, 'eee') )