summaryrefslogtreecommitdiff
path: root/tests/modules/process/test.lua
blob: 24846fd029b2af244b6d4f9b3b1cbdb6d0b34a74 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30

local inftimeout = 5000

function test_single_process(t)

    -- single process test
    local stdout = os.tmpfile()
    local stderr = os.tmpfile()
    for i = 1, 2 do
        local proc = process.open("echo -n awd", {outpath = stdout, errpath = stderr})
        proc:wait(inftimeout)
        proc:close()
        t:are_equal(io.readfile(stdout), "awd")
    end
end

function test_hack(t)

    t:will_raise(function ()
        process.waitlist("awd", inftimeout)
    end)

    t:will_raise(function ()
        process.waitlist({}, inftimeout)
    end)

    t:will_raise(function ()
        process.waitlist({"awd"}, inftimeout)
    end)
end