[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Right way to emty stdin?
- From: Gilles Ganault <gilles.ganault@...>
- Date: Wed, 23 Feb 2011 14:10:52 +0100
On Wed, 23 Feb 2011 14:57:14 +0200, steve donovan
>You did say ctrl-Z (Windows) or ctrl-D (Unix) ?
The script is launched by the server, not manually.
I modified the script so I can run it manually, and it turns out that
"if line == nil" doesn't break from the while loop:
# cat test.lua
--Must first empty stdin
while true do
local line = io.read()
-- BAD if line == nil then break end
if line == "" then break end
-- Without line below, script never ends
-- io.write("NOOP ",line,"\n")
If it works fine when ran manually, I can't find why the script
doesn't proceed when called from the server :-/