xopxe / lumen

Lua Multitasking Environment.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

bug: grab_stdout no longer works

lePereT opened this issue · comments

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()
commented

Pushed a fix, check if works.

Works!