Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Can periodic hook stop rescheduling?



On 13 September 2016 at 15:20, Peter Stephenson
<p.stephenson@xxxxxxxxxxx> wrote:
> On Tue, 13 Sep 2016 10:49:35 +0200
> The function that's being called is certainly not immune from getting
> ^C, and that can certainly stop "sched +2" in its tracks just like any
> other command.  The only general fix for this would be blocking SIGINT
> sufficiently early that ^C doesn't hit this and restoring it later ---
> but given sched +2 is the first line of the script anyway that doesn't
> look promising.

Blocking INT is the second thing done in the function:

    setopt localtraps; trap '' INT

I thought: sched will run faster than "setopt localtraps..." and this
way give better guarantee that rescheduling will not be stopped. So I
chosen to sched first, then block trap, but can reverse that, no
problem.

> You might have better results with
>
>   {
>     ...
>   } always {
>     sched +2 ...
>   }
>
> but it's still subject to the same problem if the ^C happens at the
> wrong point.
>
> This may need some lateral thinking.

"always" looked promising, too bad it's still subject to Ctrl-C

Best regards,
Sebastian Gniazdowski



Messages sorted by: Reverse Date, Date, Thread, Author