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

Re: PATCH: allocating a new file descriptor

The error message from a bad file descriptor is the system error
message, so it can change.  We can work it out by using a file
descriptor which is almost certainly invalid.

Index: Test/A04redirect.ztst
RCS file: /cvsroot/zsh/zsh/Test/A04redirect.ztst,v
retrieving revision 1.6
diff -u -r1.6 A04redirect.ztst
--- Test/A04redirect.ztst	12 Apr 2005 15:11:12 -0000	1.6
+++ Test/A04redirect.ztst	12 Apr 2005 17:33:43 -0000
@@ -3,6 +3,10 @@
   mkdir redir.tmp && cd redir.tmp
+  myfd=99
+  (echo >&$myfd) 2>msg
+  bad_fd_msg="${$(<msg)##*:}"
   print 'This is file redir' >redir  &&  cat redir
@@ -247,7 +251,7 @@
   exec {myfd}>&-
   print This message should disappear >&$myfd
 1q:Closing file descriptor using brace syntax
-?(eval):2: $myfd: bad file descriptor
+?(eval):2: $myfd:$bad_fd_msg
   typeset -r myfd
   echo This should not appear {myfd}>nologfile

Peter Stephenson <pws@xxxxxxx>                  Software Engineer
CSR PLC, Churchill House, Cambridge Business Park, Cowley Road
Cambridge, CB4 0WZ, UK                          Tel: +44 (0)1223 692070

This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the system manager.


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