blob: 64c975b292395022d0d8afca8727fdc05643714f (
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
function main()
-- single process test
local inftimeout=999
local stdout=os.tmpfile()
local stderr=os.tmpfile()
for i = 1, 2 do
local pro = process.open("echo -n awd", stdout, stderr)
process.wait(pro, inftimeout)
process.close(pro)
assert(io.readfile(stdout) == "awd")
end
-- hack test
local ok = try
{
function ()
process.wait("awd", inftimeout)
return true
end
}
assert(ok == nil)
assert(process.close("awd") == nil)
ok = try
{
function ()
process.waitlist("awd", inftimeout)
return true
end
}
assert(ok == nil)
ok = try
{
function ()
process.waitlist({}, inftimeout)
return true
end
}
assert(ok == nil)
ok = try
{
function ()
process.waitlist({"awd"}, inftimeout)
return true
end
}
assert(ok == nil)
end
|