Hi list,

I'm writing a script that shows a person a math expression (like "2 + 3")
waits for an answer, then returns if its right or wrong.
What I want though, is for it to wait something like 3 seconds and, if
there is no input, assume the user doesn't know and return "WRONG".

I thought of using 'later, in something like:

(setq A '(NIL))
(later A (timeout 3000) (in NIL (line T)))
(wait 3000)
(if (car A)
   "RIGHT"
   "WRONG" )

That is, make a child process in parallel, have It die after 3 seconds of
waiting for input, wait for three seconds, and do something depending on
whether the child returned a value (if it didn't, it timed out before the
user answered).
but I don't know how to connect the new input channel to the current
terminal.

So the questions are:
1) how to get the child to take over the input channel of the parent,
2) Is this the best way to do it? is there a better way?

Thanks

Reply via email to