-
-
Couldn't load subscription status.
- Fork 17
Open
Description
Ref: plenary.job.
As title. It'd be awesome if it could be implemented without using callbacks.
EDIT: New API
Ref: #7
local first = nio.process.run({
cmd = "printf", args = { "hello" }
})
local second = nio.process.run({
cmd = "cat", stdin = first.stdout
})
local output = second.stdout.read()
print(output)OLD
-- Just my random thoughts.
nio.run(function()
local job = nio.job.new("echo foo; echo bar; echo baz 1>&2")
local iter = job:start()
for line in iter do
if line.type == "stdout" then
on_stdout(line.content)
elseif line.type == "stderr" then
on_stderr(line.content)
elseif line.type == "exit" then
on_exit(line.exit_stat --[[@as integer]])
end
end
end)Metadata
Metadata
Assignees
Labels
No labels