Format each line of shell error output.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
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