luvit / luvit

Lua + libUV + jIT = pure awesomesauce

Home Page:https://luvit.io/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Timer is not fired on fs read

yaa110 opened this issue · comments

commented

Please consider the following code:

        local file = fs.createReadStream("/dev/zero")
        timer.setTimeout(1000, function()
                file:destroy()
                print("DONE")
        end)
        local req = http.request({
                host = "localhost",
                method = "POST",
                headers = {
                        ["Content-Type"] = 'text/plain',
                        ["Transfer-Encoding"] = "chunked"
                },
                path = "/upload",
        }, function(resp) print(resp.statusCode) end)
        file:on("data", function(data) print(#data) end)
        file:pipe(req)

Why isn't the timer fired after one second?

Cannot reproduce on Windows using luvit 2.16.0 or GitHub master. Is this still an issue? I don't have access to Linux at the moment.