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
|
function ignore_file (name)
ok = true
mytext = "text from lua1"
result = "ok"
if ok then
if existsonpath("cat") == 0 then
procfin, procfout, pid = spawn_pipe("cat")
if pid == -1 then
result = "no pid"
ok = false
else
procfin:write(mytext)
procfin:close()
line, errstr = procfout:read()
if line == nil then
result = "no line"
ok = false
elseif line ~= mytext then
result = "Expected: " .. mytext .. "\nRead: " .. line
ok = false
end
procfout:close()
ret, pid = wait(pid)
end
else
result = "Lacking cat"
x = io.open("skipfile", "w")
x:close()
end
end
if ok then
x = io.open("outfile", "w")
x:close()
end
ignore_file = function (name) return true end
return true
end
|