Commit 0d47fa8aa11a717c94d7806ef10a49e2fc68d95f

Thomas de Grivel 2014-10-03T12:25:50

Format each line of shell error output.

diff --git a/shell/sb-shell.lisp b/shell/sb-shell.lisp
index 1643152..f380bfa 100644
--- a/shell/sb-shell.lisp
+++ b/shell/sb-shell.lisp
@@ -91,3 +91,7 @@
      (format *debug-io* "~A" err)
      (force-output *debug-io*))
    err))
+
+(defmethod shell-err/line ((shell sb-shell))
+  (cl-ppcre:split #.(make-string 1 :initial-element #\Newline)
+		  (shell-err shell)))
diff --git a/shell/shell.lisp b/shell/shell.lisp
index 140c0c7..f1523a9 100644
--- a/shell/shell.lisp
+++ b/shell/shell.lisp
@@ -102,6 +102,7 @@ Error: ~S"
 (defgeneric shell-in (data shell))
 (defgeneric shell-out/line (shell))
 (defgeneric shell-err (shell))
+(defgeneric shell-err/line (shell))
 (defgeneric shell-status (shell))
 (defgeneric shell-close (shell))
 (defgeneric shell-closed-p (shell))
@@ -129,12 +130,12 @@ Error: ~S"
 		       (setf (cdr lines-tail) (cons prev nil)
 			     lines-tail (cdr lines-tail)))))
 	   (out (cdr lines-head))
-	   (err (shell-err shell)))
+	   (err (shell-err/line shell)))
       (when (find :shell *debug*)
 	(dolist (line out)
 	  (format t "~D│ ~A~%" (shell-pid shell) line))
-	(when (< 0 (length err))
-	  (format t "~D┃ ~A~&" (shell-pid shell) err)))
+	(dolist (line err)
+	  (format t "~D┃ ~A~&" (shell-pid shell) line)))
       (values status out err))))
 
 ;;  Run command