Changeset 11618

Jan 15, 2009, 11:33:45 AM (11 years ago)

In TRY-CONNECTING-TO-ALTCONSOLE, don't change fd's 0,1,and 2 in
the standlone IDE (leave them connected to /dev/null and syslog).
Do changes the fds used by lisp's standard input and output streams
and by C's stdin/stdout/stderr. (This should mean that lisp I/O
from the event thread/background threads and the kernel debugger
use the console, but random C messages - "SystemFlippers? didn't
do whatever it does, as if you care" - just get logged where no
one will see them. As of course they should ...).

1 edited


  • trunk/source/cocoa-ide/start.lisp

    r11615 r11618  
    136136;;; If we're running as a standalone .app, try to see if a bundle named
    137 ;;; exists in our PlugIns directory.  If so, execute
     137;;; exists in our Resources directory.  If so, execute
    138138;;; that bundle'es executable file, with its standard input/output/error
    139 ;;; descriptors connected to one end of a socketpair, and connect t
    140 ;;; descriptors 0,1,and 2 to the socket on the other end.
     139;;; descriptors connected to one end of a socketpair, and connect
     140;;; lisp's *TERMINAL-IO* and C's stdin/stdout/stderr to the other end
     141;;; of the socket.
    142143(defun try-connecting-to-altconsole ()
    199200                         (#_close child-socket)
    200201                         (when (eq t (ccl::check-pid pid))
    201                            (#_dup2 parent-socket 0)
    202                            (#_dup2 parent-socket 1)
    203                            (#_dup2 parent-socket 2)
     202                           (flet ((set-stdio-file-fd (f fd)
     203                                    (setf (pref f #>FILE._file) fd))
     204                                  (set-lisp-stream-fd (stream fd)
     205                                    (setf (ccl::ioblock-device (ccl::stream-ioblock stream t))
     206                                          fd)))
     207                             (set-stdio-file-fd (%get-ptr (foreign-symbol-address "___stdinp")) parent-socket)
     208                             (set-stdio-file-fd (%get-ptr (foreign-symbol-address "___stdoutp")) parent-socket)
     209                             (set-stdio-file-fd (%get-ptr (foreign-symbol-address "___stderrp")) parent-socket)
     210                             (set-lisp-stream-fd ccl::*stdin* parent-socket)
     211                             (set-lisp-stream-fd ccl::*stdout* parent-socket))
    204212                           ;; Ensure that output to the stream ccl::*stdout* -
    205213                           ;; which is connected to fd 1 - is flushed periodically
Note: See TracChangeset for help on using the changeset viewer.