diff --git a/shell/shell.lisp b/shell/shell.lisp
index 135f272..3f3e1cc 100644
--- a/shell/shell.lisp
+++ b/shell/shell.lisp
@@ -130,25 +130,29 @@ Error: ~S"
(force-output log))))
(defmethod shell-status ((shell shell))
- (let* ((delim (make-delimiter))
+ (let* ((delim (the string (make-delimiter)))
(len (length delim))
- (lines-head (cons nil nil))
+ (lines-head (cons (str #\Newline) nil))
(lines-tail lines-head))
(shell-in (format nil " ; echo \"~%~A $?\"~%" delim) shell)
- (let* ((status (do ((line #1=(shell-out/line shell) #1#)
- (prev nil line))
- ((or (null line)
- (and (< len (length line))
- (string= delim line :end2 len)))
- (when line
- (when (debug-p :shell*)
- (debug-out "$ "))
- (parse-integer line :start len)))
- (when prev
- (when (debug-p :shell*)
- (debug-out "~A~%" prev))
- (setf (cdr lines-tail) (cons prev nil)
- lines-tail (cdr lines-tail)))))
+ (let* ((prev nil)
+ (status
+ (loop (let ((line (the string (shell-out/line shell))))
+ (when (or (null line)
+ (and (< len (length line))
+ (string= delim line :end2 len)))
+ (unless (or (null prev) (string= "" prev))
+ (setf (cdr lines-tail) (cons prev nil)))
+ (return (when line
+ (when (debug-p :shell*)
+ (debug-out "$ "))
+ (parse-integer line :start len))))
+ (when prev
+ (when (debug-p :shell*)
+ (debug-out "~A~%" prev))
+ (setf (cdr lines-tail) (cons (str prev #\Newline) nil)
+ lines-tail (cdr lines-tail)))
+ (setf prev line))))
(out (cdr lines-head))
(err (shell-err/line shell)))
(when (shell-log-p shell)