summaryrefslogtreecommitdiff
path: root/tests/modules/process/sched_process_pipe.lua
diff options
context:
space:
mode:
Diffstat (limited to 'tests/modules/process/sched_process_pipe.lua')
-rw-r--r--tests/modules/process/sched_process_pipe.lua20
1 files changed, 9 insertions, 11 deletions
diff --git a/tests/modules/process/sched_process_pipe.lua b/tests/modules/process/sched_process_pipe.lua
index d3690d619..deb350372 100644
--- a/tests/modules/process/sched_process_pipe.lua
+++ b/tests/modules/process/sched_process_pipe.lua
@@ -4,34 +4,32 @@ import("core.base.scheduler")
function _session_read_pipe(id, rpipeopt)
local results = {}
- local pipe = rpipeopt.pipe
- print("%s/%d: read ..", pipe, id)
+ local rpipe = rpipeopt.rpipe
+ print("%s/%d: read ..", rpipe, id)
while not rpipeopt.stop do
- local real, data = pipe:read(8192)
+ local real, data = rpipe:read(8192)
if real > 0 then
table.insert(results, bytes(data, 1, real))
elseif real == 0 then
- if pipe:wait(pipe.EV_READ, -1) < 0 then
+ if rpipe:wait(pipe.EV_READ, -1) < 0 then
break
end
else
break
end
end
- if #results > 0 then
- results = bytes(results)
- end
- print("%s/%d: read ok, size: %d", pipe, id, results:size())
+ results = bytes(results)
+ print("%s/%d: read ok, size: %d", rpipe, id, results:size())
if results:size() > 0 then
results:dump()
end
- pipe:close()
+ rpipe:close()
end
function _session(id, program, ...)
local rpipe, wpipe = pipe.openpair(10)
- local rpipeopt = {pipe = rpipe, stop = false}
- scheduler.co_start(_session_read_pipe, i, rpipeopt)
+ local rpipeopt = {rpipe = rpipe, stop = false}
+ scheduler.co_start(_session_read_pipe, id, rpipeopt)
local proc = process.openv(program, table.pack(...), {stdout = wpipe})
local ok, status = proc:wait(-1)
rpipeopt.stop = true