When I use SBCL's run-program function to run a Unix command from the Slime REPL and the command produces a lot of output, I get a run time error. A sample acktrace is included below. Examples are:
(sb-ext:run-program "/bin/cat" '("/etc/bash_completion") :output *terminal-io* :search t :wait t)
or
(sb-ext:run-program "/bin/cat" '("/etc/bash_completion") :output *standard-output* :search t :wait t)
If I collect the output into a string and then print the string, everything works fine:
(progn (princ (with-output-to-string (out) (sb-ext:run-program "/bin/cat" '("/etc/bash_completion") :output out :search t :wait t)) *terminal-io*) nil)
My goal is to see the command's output as it's generated. Does anyone know how to do this?
bob
====================
non-empty buffer when EOF reached while reading from child: #(99 117 114 32 41 32 41 10 9 9 ...) [Condition of type SIMPLE-ERROR]
Restarts: 0: [ABORT] Abort sending output to Emacs. 1: [RETRY] Retry SLIME REPL evaluation request. 2: [ABORT] Return to SLIME's top level. 3: [ABORT] Exit debugger, returning to top level.
Backtrace: 0: ((LAMBDA (SB-IMPL::FD)) #<unavailable argument>) 1: (SB-IMPL::SUB-SUB-SERVE-EVENT 0 200000) 2: (SB-IMPL::SUB-SERVE-EVENT 0 200000 NIL) 3: ((LAMBDA (SWANK-BACKEND::STREAMS &OPTIONAL SWANK-BACKEND::TIMEOUT)) (#<SB-SYS:FD-STREAM for "a socket" {B36B031}>) NIL) 4: (SWANK::WAIT-FOR-EVENT/EVENT-LOOP (:EMACS-PONG 16) NIL) 5: (SWANK::WAIT-FOR-EVENT (:EMACS-PONG 16) NIL) 6: (SWANK::SEND-USER-OUTPUT ..) 7: ((LAMBDA ())) 8: ((LAMBDA ())) 9: ((SB-PCL::FAST-METHOD STREAM-FINISH-OUTPUT (SWANK-BACKEND::SLIME-OUTPUT-STREAM)) #(3 NIL 2 NIL 5 NIL ...) #<unavailable\ argument> #<SWANK-BACKEND::SLIME-OUTPUT-STREAM {AAB0BF1}>) 10: ((LAMBDA ())) 11: ((SB-PCL::FAST-METHOD STREAM-WRITE-STRING (SWANK-BACKEND::SLIME-OUTPUT-STREAM T)) ..) 12: (SB-IMPL::%WRITE-STRING ..) 13: ((LAMBDA (SB-IMPL::FD)) #<unavailable argument>) 14: (SB-IMPL::SUB-SUB-SERVE-EVENT 1 0) 15: (SB-IMPL::SUB-SERVE-EVENT 1 0 NIL) 16: (SB-SYS:SERVE-ALL-EVENTS 1) 17: (PROCESS-WAIT #<SB-IMPL::PROCESS 9630 :SIGNALED> NIL) 18: (RUN-PROGRAM "/bin/cat" ("/etc/bash_completion"))[:EXTERNAL] 19: (SB-INT:SIMPLE-EVAL-IN-LEXENV (RUN-PROGRAM "/bin/cat" '("/etc/bash_completion") :OUTPUT *STANDARD-OUTPUT* :SEARCH ...) \ #<NULL-LEXENV>) 20: (SWANK::EVAL-REGION "(sb-ext:run-program "/bin/cat" '("/etc/bash_completion") :output *standard-output* :search t :\ wait t)\n") 21: ((LAMBDA ())) 22: (SWANK::TRACK-PACKAGE #<CLOSURE (LAMBDA #) {B05A8AD}>) 23: (SWANK::CALL-WITH-RETRY-RESTART "Retry SLIME REPL evaluation request." #<CLOSURE (LAMBDA #) {B05A83D}>) 24: (SWANK::CALL-WITH-BUFFER-SYNTAX NIL #<CLOSURE (LAMBDA #) {B05A825}>) 25: (SWANK::REPL-EVAL "(sb-ext:run-program "/bin/cat" '("/etc/bash_completion") :output *standard-output* :search t :wa\ it t)\n")