xopxe / lumen

Lua Multitasking Environment.
Other
153 stars 23 forks source link

bug: grab_stdout no longer works #20

Closed lePereT closed 2 years ago

lePereT commented 2 years ago

The following test case has stopped working with the latest commits to the sleector module. Tested with Lua 5.1.5.

local sched = require 'lumen.sched'
local stream = require 'lumen.stream'
local selector = require 'lumen.tasks.selector'

selector.init({service='nixio'})

local astream=stream.new()

-- task that issues command
sched.run(function()
    local sktd = selector.grab_stdout('ping -c 5 8.8.8.8', '*a', astream)
end)

-- task receives ping output
sched.run(function()
    while true do
        local a, b, c = astream:read()
        if a ~= nil then
            print (a)
        else
            return
        end
    end
end)

sched.loop()
xopxe commented 2 years ago

Pushed a fix, check if works.

lePereT commented 2 years ago

Works!