<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<p>Dear all,</p>
<p>Maxima (which is written in lisp) connects to its front-end using
a network socket. stdout and stderr of the lisp are redirected to
this socket. <br>
</p>
<p>If the front-end dies unexpectedly this seems to cause ECL to
output an error message which (since it cannot be output) causes
an error message which causes...<br>
</p>
<p>On gcl maxima just catches the SIGPIPE signal and exits if the
pipe breaks. ECL offers <span class="st">ECL_OPT_TRAP_SIGPIPE but
I don't know what to do with it.<br>
</span></p>
<p><span class="st">Could anyone give me a hand?</span></p>
<p><span class="st"><br>
</span></p>
<p><span class="st">the function that sets up the server is:<br>
</span></p>
<p><br>
<span class="st">(defun setup-client (port &optional (host
"localhost"))<br>
;; The following command has to be executed on windows before<br>
;; the connection is opened. If it isn't the first unicode <br>
;; character maxima wants to send causes sbcl to wait
indefinitely.<br>
#+sbcl (setf sb-impl::*default-external-format* :utf-8)<br>
(multiple-value-bind (sock condition) (ignore-errors
(open-socket host port))<br>
(unless sock<br>
; It appears that we were unable to open a socket or
connect to the<br>
; specified port.<br>
(mtell (intl:gettext "~%Unable to connect Maxima to port
~:M.~%") port)<br>
(mtell (intl:gettext "Error: ~A~%") condition)<br>
($quit))<br>
#+gcl (setq si::*sigpipe-action* 'si::bye)<br>
(setq *socket-connection* sock)<br>
(setq $old_stderr *error-output*<br>
$old_stdout *standard-output*)<br>
#+ecl (setq *old-stdin* *standard-input*<br>
*old-stdout* *standard-output*<br>
*old-sterr* *error-output*<br>
*old-term-io* *terminal-io*<br>
*old-debug-io* *debug-io*)<br>
(setq *standard-input* sock)<br>
(setq *standard-output* sock)<br>
(setq *error-output* sock)<br>
(setq *terminal-io* sock)<br>
(setq *trace-output* sock)<br>
(format t "pid=~a~%" (getpid))<br>
(force-output sock)<br>
(setq *debug-io* sock))<br>
(values))<br>
</span></p>
<p><span class="st"><br>
</span></p>
<p><span class="st">Kind regards,</span></p>
<p><span class="st"><br>
</span></p>
<p><span class="st"> Gunter.<br>
</span></p>
</body>
</html>