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

Re: Test failure in redirect.



On Feb 4,  9:03pm, Zefram wrote:
} Subject: Re: Test failure in redirect.
}
} Bart Schaefer wrote:
} >}   print foo >&-
} >} Error output:
} >} (eval):print:1: write error: bad file descriptor
} ...
} >+	/* Testing EBADF special-cases >&- redirections */
} >+	if ((fout != stdout) ? (fclose(fout) != 0) :
} >+	    (fflush(fout) != 0 && errno != EBADF)) {
} 
} I think the error message is correct and should remain; the test data
} is what needs to be fixed.

I don't think so ... closing stdout should not produce an error from a
builtin that does output.  E.g. here's bash:

[schaefer@zagzig schaefer]$ echo foo >&-
[schaefer@zagzig schaefer]$ echo $?
0
[schaefer@zagzig schaefer]$ 

The "print" command has to execute, e.g. in case it's given -P and there
are side-effects of the prompt expansion due to the PROMPT_SUBST option,
but it must not produce any output and it definitely shouldn't return 
nonzero.

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com

Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net   



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