RE: sleep
[
Date Prev][
Date Next][
Thread Prev][
Thread Next]
[
Date Index]
[
Thread Index]
- Subject: RE: sleep
- From: Jorge <xxopxe@...>
- Date: 2009年5月20日 21:15:54 -0300
On Wed, 2009年05月20日 at 17:57 -0400, Aaron Brown wrote:
> If you're on a unix or another system that has a sleep command callable
> from a shell, you can do:
>
> os.execute("sleep 5")
If your code is very tight you can have problem canceling your script:
the ctr-c must catch your code and not the sleep. Otherwise you just
cancel the waiting and "do stuff" again. What i do is:
if os.execute("sleep 5") ~= 0 then return end
(or break if in a loop, etc.). This way, if you press ctrl-c while in
sleep, you'll cancel the script also.
Jorge.