From: Andrej Grozin <grozin@pa...> - 2005-11-21 14:02:49
Sorry, I am not an sbcl developer. I am the maintainer of the
TeXmacs/maxima interface. And I have a problem when maxima runs in sbcl
Maxima simetimes asks interactive questions. If stdin is a tty, all works
fine. But when maxima is run from TeXmacs, it reads from a pipe.
The problem is not TeXmacs-specific at all. We can see it if we enter, at
the command-line prompt,
cat | maxima -l sbcl
Then, at the maxima prompt, let's input something which results in maxima
asking a question, e.g.,
Is a positive or negative?
OK, we reply
At this point maxima/sbcl hangs, and the only thing to be done is to kill
the process. The same happens with maxima/cmucl; gcl and clisp work fine.
And, of course, when there is no "cat |", all 4 work.
It seems that sbcl checks if stdin is a tty, and if it is not, it does not
do some necessary fflush(stdout);
Is there any easy method to fool sbcl into thinking that it is being run
interactively? I suppose this can be done using pty, but I never did this
before, and this seems to be a lot of work. Maybe, there are simpler ways?
Hoping for some help,
On Mon, 21 Nov 2005, Andrej Grozin wrote:
> Maxima simetimes asks interactive questions. If stdin is a tty, all works
> fine. But when maxima is run from TeXmacs, it reads from a pipe.
Seems like a bug SBCL:
demoss@...:~$ cat | sbcl --noinform
* (read-char *standard-input*)
* (read-char *terminal-io*)
Offhand I cannot tell if the problem is with *terminal-io* / sb-sys:*tty*,
or with eg. two-way-streams in general.
You might be able to work around this with something like
(make-two-way-stream *standard-input* *standard-output*))
but note that assigning to *terminal-io* is implementation defined. I hope
-- Nikodemus Schemer: "Buddha is small, clean, and serious."
Lispnik: "Buddha is big, has hairy armpits, and laughs."
From: Andrej Grozin <grozin@pa...> - 2005-11-22 10:33:30
On Mon, 21 Nov 2005, Nikodemus Siivola wrote:
> You might be able to work around this with something like
> (setf *terminal-io*
> (make-two-way-stream *standard-input* *standard-output*))
> ;; untested
Thanks, this solves the problem (for cmucl too).