I execute commands in a loop and wish to be able to interrupt the loop
with SIGINT.  Here’s the first attempt:

    guile -c \
      '(for-each (lambda (n)
                  (display n)
                  (system* "sleep" "3"))
                 (list 1 2 3 4))'

At no point will this program be interrupted by SIGINT.  Strace reveals
that SIGINT is in fact received and the sleep is interrupted, but the
wait is restarted immediately afterward.

This program on the other hand *can* be interrupted at any point:

    guile -c \
      '(for-each (lambda (n)
                  (if (zero? (primitive-fork))
                   (begin (display n)
                          (execlp "sleep" "sleep" "3"))
                   (waitpid WAIT_ANY)))
                 (list 1 2 3 4))'

Is this by design?

-- 
Ricardo



Reply via email to