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

Trap bug?



This doesn't work correctly in 3.1.2:

   function f
   {
      (   trap 'print "INT f"; return 0' INT
          while true; do :; done
      )

      print "Leaving f"
   }

   f
   print "Leaving script"

Hitting Ctrl-C during the loop in f causes an immediate exit from the
_script_, not just a return from the function, as it should (IMHO).

If the trap command is outside the parentheses, it works:

   function f
   {   trap 'print "INT f"; return 0' INT

      (   
          while true; do :; done
      )

      print "Leaving f"
   }

But then the traps won't be automatically restored before leaving the
function, which is what I intended.

	Bernd

--
Bernd Eggink
Regionales Rechenzentrum der Uni Hamburg
eggink@xxxxxxxxxxxxxxxxxx
http://www.rrz.uni-hamburg.de/eggink/BEggink.html



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