lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


> >Why, when I run the following:
> >
> >lua -e "io.stdin:read '*a'"
> >
> >do I need to press Ctrl+C twice to escape?
>
> Because lua (the interpreter) can only stop when control handed is back to Lua
> (the core) because Lua needs to ensure that the state is consistent.

Sorry, I've been looking at the code and worked it all out. The message
above was a slightly selfish "insurance policy" sent just before I went to
bed.

> If you interrupt a C routine that takes a long time then you'll probably
> become impatient and hit Ctrl+C twice, in which case the program will be
> aborted silently. If you are patient, then you'll see the "interrupted!"
> message. Try
>
> 	lua -e "a=string.rep('a',1e8)"

With this sort of thing, I see "interrupted!" if I hit Ctrl+C once. The
command I actually ran was

    lua -e "for i = 1, 100000000 do j = 2 end"

I suppose that's different, though, because it doesn't go outside the VM,
whereas string.rep does.

-- 
http://www.mupsych.org/~rrt/ | What you don't know controls you