[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: problems with INTERACTIVE-STREAM-P



Nathan Sidwell <nathan@bristol.st.com> writes:

> I was assuming that *error-output* was a unidirectional stream (thus
> reading it would be silly), and that interactivity was essentially
> determined by isatty(fileno).

Streams can be unidirectional or bidirectional, in Common Lisp as well
as in Unix. (Unix sockets are "bi"). INTERACTIVE-STREAM-P queries the
input side of the stream.

> > (How do you tell that a file descriptor is pointing to /dev/null
> > when all you have is the file descriptor?)
> err, isatty(3)?

Nope, doesn't work. isatty() of a pipe handle is false, so when you
run clisp within an Emacs buffer, connected to Emacs via pipes, isatty()
will tell you "false", but INTERACTIVE-STREAM-P will say "yes".

> Anyway I've solved my problem, with the rather inelegant solution of
> 	(zerop (shell "tty -s 0<&1"))

The same argument holds here, as for isatty().


Bruno Haible                                     email: <haible@ilog.fr>
Software Engineer                                phone: +33-1-49083585