summaryrefslogtreecommitdiff
path: root/tests/modules/process/process_autoexit.lua
blob: c7d56a286e71bd44900eaf07f6855a07edcf3c87 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
import("core.base.process")
import("core.base.scheduler")

function main(cmd)
    for i = 1, 10 do
        scheduler.co_start(function ()
            process.open(cmd or "xmake l os.sleep 60000")
            --process.openv("xmake", {"l", "os.sleep", "60000"}, {detach = true}):close()
        end)
    end
    -- check processes status after exiting
    -- we need to terminate all unclosed processes automatically after parent process is exited
    -- ps aux | grep sleep
end