1 -- $Id: pty.lua,v 1.4 2005/04/03 20:28:22 cpressey Exp $
3 local Pty = require("pty")
5 p, err = Pty.open("/usr/games/adventure")
24 local read_until_timeout = function(p)
28 text, err = p:read(100)
29 while err ~= Pty.TIMEOUT do
34 text, err = p:read(100)
41 p:write(input[i] .. "\n")
42 t, err = read_until_timeout(p)
46 if err == Pty.EOF then
59 -- Test for resource leakage.
61 p, err = Pty.open("ls")
67 --Clock.nanosleep(0.01)
71 print("Cannot open pty: ", err)
74 print(k, "out of", maxi, "pty's opened and closed ok")