[Ecls-list] emacs polling forever

Tobias C. Rittweiler tcr at freebits.de
Tue May 25 09:14:02 UTC 2010


"a" <fbogdanovic at xnet.hr> writes:

> --------------------------------------------------------------------------
> (progn (load "c:\\lisp\\slime\\swank-loader.lisp" :verbose t) (funcall (read-from-string "swank-loader:init")) (funcall (read-from-string "swank:start-server") "c:\\DOCUME~1\\h\\LOCALS~1\\Temp\\slime.608" :coding-system "iso-latin-1-unix"))
>
> ECL (Embeddable Common-Lisp) 10.4.1
> Copyright (C) 1984 Taiichi Yuasa and Masami Hagiya
> Copyright (C) 1993 Giuseppe Attardi
> Copyright (C) 2000 Juan J. Garcia-Ripoll
> ECL is free software, and you are welcome to redistribute it
> under certain conditions; see file 'Copyright' for details.
> Type :h for Help.  
> Top level in: #<process SI:TOP-LEVEL 00a50fc0>.
>> 
> ;;; Loading "c:/lisp/slime/swank-loader.lisp"
> ;;; Loading #P"c:/lisp/ecl/inst/cmp.fas"
> ;;; Loading #P"c:/lisp/ecl/inst/sysfun.lsp"
> ;;;
> ;;; Compiling c:/lisp/slime/swank-backend.lisp.
> ;;; OPTIMIZE levels: Safety=2, Space=0, Speed=3, Debug=0
> ;;;
> ;;; Note:
> ;;;   in file swank-backend.lisp, position 38780
> ;;;   at (DEFINTERFACE CALL-WITH-LOCK-HELD ...)
> ;;;   In function G648, checking types of arguments FUNCTION.
> ;;; End of Pass 1.
> ;;; Note:
> ;;;   Invoking external command:
> ;;;   cl -I"c:/lisp/ecl/inst/"  /EHsc /DGC_DLL /DGC_BUILD /nologo /D_CRT_SECURE_NO_DEPRECATE /DNDEBUG /MD /O2  /O2 -w -c "C:/Documents and Settings/h/Application Data/.slime/fasl/2010-05-16/ecl-10.4.1-windows-pentium4/swank-backend.c" -Fo"C:/Documents and Settings/h/Application Data/.slime/fasl/2010-05-16/ecl-10.4.1-windows-pentium4/swank-backend.obj"
> ;;; 
> ;;; Internal error:
> ;;;   ** (SYSTEM "cl -I\"c:/lisp/ecl/inst/\"  /EHsc /DGC_DLL /DGC_BUILD /nologo /D_CRT_SECURE_NO_DEPRECATE /DNDEBUG /MD /O2  /O2 -w -c \"C:/Documents and Settings/h/Application Data/.slime/fasl/2010-05-16/ecl-10.4.1-windows-pentium4/swank-backend.c\" -Fo\"C:/Documents and Settings/h/Application Data/.slime/fasl/2010-05-16/ecl-10.4.1-windows-pentium4/swank-backend.obj\"") returned non-zero value -4194303;; 
> ;; Error while compiling c:/lisp/slime/swank-backend.lisp:
> ;;   COMPILE-FILE returned NIL.
> ;; Aborting.
> ;; 

Juan: Notice how gcc returns -4194303 as exit code.

I think we may have talked in the past how to make the GCC's error
output available to Lisp. Forgot the details. 

I recently wrote the following bits on top of SBCL's RUN-PROGRAM. By
default, no output is shown but it's still saved in case the external
process dies with a non-zero exit code.


(defvar *shell-input-stream* nil)
(defvar *shell-output-stream* nil)
(defvar *shell-error-stream* nil)

(defun execute-command (cmd args)
  (flet ((hijack (shell-stream string-stream)
           (if shell-stream
               (make-broadcast-stream string-stream shell-stream)
               string-stream)))
    (let* ((string-stream (make-string-output-stream))
           (child (sb-ext:run-program cmd args
                    :search t :wait t
                    :input  *shell-input-stream*
                    :output (hijack *shell-output-stream* string-stream)
                    :error  (hijack *shell-error-stream*  string-stream))))
      (values (sb-ext:process-exit-code child)
              (get-output-stream-string string-stream)))))

(defun shell (cmd &rest args)
  "Fork'n'Exec."
  (multiple-value-bind (return-code output)
      (execute-command cmd args)
    (assert (zerop return-code) ()
            "Command ~S ~:_exited with code ~D.~%~A"
            (cons cmd args)
            return-code
            output)))

;;; E.g. (shell "ls" "-l" "does-not-exist")

  -T.





More information about the ecl-devel mailing list