[pro] Default behavior of standard output streams
Pascal J. Bourguignon
pjb at informatimago.com
Tue May 22 09:50:21 UTC 2012
Didier Verna <didier at lrde.epita.fr> writes:
> Hello,
>
> there is a discrepancy amongst compilers on how the default output
> streams
s/compilers/implementations/
> behave in some situations. Consider the following test case:
>
> (format *standard-output* "This goes to standard output.~%")
> (format *error-output* "This goes to error output.~%")
> (format *query-io* "This goes to query io.~%")
>
>
> Now, launch you favorite Lisp on a terminal and load this file at
> startup in 3 different ways:
>
> myfavoritelisp --the-load-option test.lisp
> myfavoritelisp --the-load-option test.lisp > log
> myfavoritelisp --the-load-option test.lisp > log 2>&1
>
>
> SBCL and CMUCL behave in a way which I think is right:
> case #1: everything is printed on the terminal
> case #2: stdout goes in the file
> case #3: stdout and stderr go in the file (*query-io* stays on the tty)
I agree.
> ECL redirects the output of *query-io* in the file for cases #2 and #3.
> The behavior of stdout and stderr is the same as in SBCL and CMUCL.
>
> Finally, LW, ACL, CLISP, CCL and ABCL redirect everything in the file in
> cases #2 and #3.
>
>
> I'm ready to fill in bug reports for the last 6 compilers, but are these
> really bugs? I'm convinced that it is for stderr, but it may be arguable
> for *query-io*.
>
> WDYT?
Those are not bugs. Those are unspecified, implementation dependent
behaviors. Well *query-io* is somewhat informally specified, so we
definitely could consider that it should use /dev/tty on systems
providing it.
AFAIK, /dev/tty is not POSIX (posix doesn't specify /dev/). So this
specification would have to be restricted to systems providing /dev/tty
or a similar feature.
You should write a CDR, and then indeed ask vendors to implement it.
--
__Pascal Bourguignon__ http://www.informatimago.com/
A bad day in () is better than a good day in {}.
More information about the pro
mailing list