Commit 256ea3dcb373ff32312705a29c50acea61f07ffb

Thomas de Grivel 2018-07-10T12:43:50

shell

diff --git a/shell/sb-shell.lisp b/shell/sb-shell.lisp
index d999510..2c5462a 100644
--- a/shell/sb-shell.lisp
+++ b/shell/sb-shell.lisp
@@ -67,14 +67,14 @@
 	(sb-ext:process-kill process sb-unix:sigterm)
 	(sb-ext:process-close process)))))
 
-(defmethod shell-in :after (data (shell sb-shell))
-  (when (debug-p :sb-shell)
-    (debug-out "~A" data))
-  (force-output (sb-ext:process-input (shell-process shell))))
-
 (defmethod shell-in ((data string)
 		     (shell sb-shell))
-  (write-string data (sb-ext:process-input (shell-process shell))))
+  (let ((in (sb-ext:process-input (shell-process shell))))
+    (write-string data in)
+    (finish-output in)
+    (when (debug-p :sb-shell)
+      (debug-out "~A" data))
+    shell))
 
 (defmethod shell-out/line ((shell sb-shell))
   (let ((out (read-line (sb-ext:process-output (shell-process shell)) nil nil)))
diff --git a/shell/shell.lisp b/shell/shell.lisp
index aaebd1a..d4cb784 100644
--- a/shell/shell.lisp
+++ b/shell/shell.lisp
@@ -123,7 +123,7 @@ Error: ~S"
 (defmethod shell-log ((shell shell) (fmt string) &rest args)
   (let ((log (shell-log-stream shell)))
     (when log
-      (format log "~D" (shell-pid shell))
+      (format log "~&~D" (shell-pid shell))
       (apply #'format log fmt args)
       (force-output log))))
 
@@ -154,14 +154,15 @@ Error: ~S"
 	  (shell-log shell "| ~A~%" line))
 	(dolist (line err)
 	  (shell-log shell "# ~A~&" line))
-	(shell-log shell   " ⇒ ~D~%" status))
+        (unless (= 0 status)
+          (shell-log shell   " ⇒ ~D~%" status)))
       (values status out err))))
 
 ;;  Run command
 
 (defmethod shell-run-command ((command string) (shell shell))
   (when (debug-p :shell)
-    (format t "~D╭ $ ~A~%" (shell-pid shell) command))
+    (format t "~&~D╭ $ ~A~%" (shell-pid shell) command))
   (shell-in command shell)
   (shell-status shell))