Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
luvit: uv: Stream: guard against writing to closed stream
writing to a closed stream will cause an error, avoid doing that.
  • Loading branch information
philips committed Aug 10, 2012
1 parent cba6ad1 commit 9482ac0
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion lib/luvit/uv.lua
Expand Up @@ -106,7 +106,13 @@ function Stream:resume()
end

-- Stream:write(chunk, callback)
Stream.write = native.write
function Stream:write(chunk, callback)
if self._closed then
error("attempting to write to closed stream")
return
end
native.write(self, chunk, callback)
end

Stream.pipe = iStream.pipe

Expand Down

0 comments on commit 9482ac0

Please sign in to comment.