Skip to content

Instantly share code, notes, and snippets.

@cablehead
Created December 12, 2017 21:29
Show Gist options
  • Save cablehead/ce298130f1f587275076a06f96d4f4e3 to your computer and use it in GitHub Desktop.
Save cablehead/ce298130f1f587275076a06f96d4f4e3 to your computer and use it in GitHub Desktop.
local levee = require("levee")
local _ = levee._
local h = levee.Hub()
local r, w = h.io:pipe()
h:spawn(function()
w:write(("X"):rep(16*1024*1024))
w:close()
end)
local buf = levee.d.Buffer(4096)
while true do
buf:ensure()
local err, n = r:read(buf.buf + buf.len, buf.cap - buf.len)
if err then break end
buf.len = buf.len + n
print(buf.len)
end
print("here")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment