On Wed, May 04, 2022 at 10:50:50AM +0200, Ralf Hemmecke wrote:
> >>(defun OBEY (S)
> >> (sb-ext::process-exit-code
> >> (sb-ext::run-program "/bin/sh" (list "-c" S) :input t
> >> :output *standard-output* :error *standard-output*)))
> >>
> >>and would be somehow happy if I wouldn't have to do this.
> >
> >That looks reasonable. Currently we have 't' which means
> >'*termianl-io*'. Usualy termial IO is the same as standard
> >output, but sometimes sbcl is doing crazy things with it.
> >AFAICS we _never_ want sbcl '*termianl-io*'.
>
> Thank you. Would that mean that I could prepare a patch to change OBEY in
> vmlisp.lisp to
>
> #+:sbcl
> (defun OBEY (S)
> #-:win32 (sb-ext::process-exit-code
> (sb-ext::run-program "/bin/sh"
> (list "-c" S) :input t :output *standard-output*
> :error *error-output*))
> #+:win32 (sb-ext::process-exit-code
> (sb-ext::run-program "sh"
> (list "-c" S) :input t :output *standard-output*
> :error *error-output*)))
>
> Or rather as I suggestet to ":error *standard-output*"?
Sorry for confusion. I wrongly assumed that 'sb-ext::run-program'
uses standard Lisp convention about stream use. Looking into
'sb-ext::run-program' docs shows that 't' means inheriting
standard input, output and error output from current process,
which at least in some cases seem to be right thing.
You say that you want to catch error output. But what errors?
A little grepping of sources shows that currently one main use case
for OBEY is starting external editor, where inherited file descriptors
seem to be correct (and in jFriCAS you probably do not want to support
this or offer replacement compatible with Web interface). Other use
case are calls to few system commands where errors are _not_ expected.
If some unexpected error pops up it is debatable where message should go,
but resonable convention is that those errors should go to FRICASsys
standard error.
In particular, I not sure what you are doing with OBEY that you
need to catch standard output?
To put it differently, ATM you can launch text editor or a shell
via ')system' command and it almost works (there is some breakage
due to clef/rlwrap interfering, AFAICS without sman it works
fine). This is not very important use case, but it is nice
to keep what works working. OTOH in jFriCAS I would _not_
expect current ')system' to work, at least not without some
alternative implementation.
>
> For jfricas it wouldn't probably matter since I anyway set *error-output* to
> *standard-output*.
>
> In fact, browsing through the FriCAS code, it seems that *error-output* is
> only used in the lisp optimizer.
Well, currently when we generate Lisp code Lisp '*standard-output*' is
redirected to file. But we definitely do not want error messages going
to '*standard-output*': some messages are just warning, but if
emmited to file would make it syntactiacally incorrect. User normally
does not look at generated file so error messages emmited to file
are effectively lost. We should be more consistent about this in
other places, error messages should consistenly go to '*error-output*'
but since in many cases '*standard-output*' and '*error-output*'
are the same wrong code may "work" for long time.
BTW: As I wrote Saturn (Texexplorer) had notebook interface. While
code supporting Saturn is removed now you can look at past versions
to see how they handled tricky problems. In particular i-output.boot
was modified to behave as needed by Saturn. IIRC this included
TeX output of types and handling of line numbers.
BTW2: My impression is that in Saturn "unexpected" error messages
went to AXIOMsys console.
--
Waldek Hebisch
--
You received this message because you are subscribed to the Google Groups
"FriCAS - computer algebra system" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/fricas-devel/20220504230148.GB1546%40fricas.math.uni.wroc.pl.