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

PATCH: tests for trap problems



This tests for the two trap problems we had recently, TRAPZERR triggering
too often and localtraps causing a crash --- that's why I'm using `unset -f
TRAPZERR' as in the problem seen, rather than the more usual `trap -
ZERR'.

Maybe we need an option to recognise ERR as an alias for ZERR on machines
which don't have a SIGERR.

Index: Test/08traps.ztst
===================================================================
RCS file: /cvsroot/zsh/zsh/Test/08traps.ztst,v
retrieving revision 1.2
diff -u -r1.2 08traps.ztst
--- Test/08traps.ztst	2000/04/30 14:48:50	1.2
+++ Test/08traps.ztst	2000/05/04 11:24:12
@@ -148,3 +148,30 @@
 >end of fn
 >finish
 
+  TRAPZERR() { print 'ERR-or!'; }
+  f() { print f; false; }
+  t() { print t; }
+  f
+  f && t
+  t && f && true
+  t && f
+  testunset() {
+    setopt localtraps
+    unset -f TRAPZERR
+    print testunset
+    false
+    true
+  }
+  testunset
+  f
+1: more sophisticated error trapping
+>f
+>ERR-or!
+>f
+>t
+>t
+>f
+>ERR-or!
+>testunset
+>f
+>ERR-or!

-- 
Peter Stephenson <pws@xxxxxxxxxxxxxxxxxxxxxxxxx>
Cambridge Silicon Radio, Unit 300, Science Park, Milton Road,
Cambridge, CB4 0XL, UK                          Tel: +44 (0)1223 392070



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