]> git.eshelyaron.com Git - emacs.git/commitdiff
; Improve recent change to printing exit status in Eshell
authorJim Porter <jporterbugs@gmail.com>
Wed, 13 Sep 2023 01:13:52 +0000 (18:13 -0700)
committerJim Porter <jporterbugs@gmail.com>
Wed, 13 Sep 2023 01:13:52 +0000 (18:13 -0700)
* lisp/eshell/esh-proc.el (eshell-interactive-filter): Declare.
(eshell-interactive-process-filter): Simplify.
(eshell-sentinel): Call 'eshell-interactive-filter'.

* test/lisp/eshell/esh-proc-tests.el
(esh-proc-test/kill-process/redirect-message): Use
'eshell-with-temp-buffer'.

lisp/eshell/esh-proc.el
test/lisp/eshell/esh-proc-tests.el

index 5bfcbd6dc159740b26d5e16e6c1ec7a747797b6a..5df68947ec218dc04634ea4d96495e49d1727999 100644 (file)
@@ -112,6 +112,7 @@ To add or remove elements of this list, see
 `eshell-record-process-object' and `eshell-remove-process-entry'.")
 
 (declare-function eshell-send-eof-to-process "esh-mode")
+(declare-function eshell-interactive-filter "esh-mode" (buffer string))
 (declare-function eshell-tail-process "esh-cmd")
 
 (defvar-keymap eshell-proc-mode-map
@@ -437,8 +438,6 @@ This is done after all necessary filtering has been done."
      'process (format-message "received output from process `%s'\n\n%s"
                               process string))
     (eshell--mark-as-output 0 (length string) string)
-    (require 'esh-mode)
-    (declare-function eshell-interactive-filter "esh-mode" (buffer string))
     (eshell-interactive-filter (if process (process-buffer process)
                                  (current-buffer))
                                string)))
@@ -511,7 +510,8 @@ PROC is the process that's exiting.  STRING is the exit message."
                        (eshell-interactive-output-p eshell-error-handle handles)
                        (not (string-match "^\\(finished\\|exited\\)"
                                           string)))
-              (eshell-output-object string eshell-error-handle handles))
+              (eshell--mark-as-output 0 (length string) string)
+              (eshell-interactive-filter (process-buffer proc) string))
             (process-put proc :eshell-pending nil)
             ;; If we're in the middle of handling output from this
             ;; process then schedule the EOF for later.
index 52f8aeaedbe041a6a4e34b9750c036d349abbe7f..d58764ac29fa96a00123fafc4abe5b86aba3797b 100644 (file)
@@ -316,11 +316,10 @@ write the exit status to the pipe.  See bug#54136."
 (ert-deftest esh-proc-test/kill-process/redirect-message ()
   "Test that killing a process with a redirected stderr omits the exit status."
   (skip-unless (executable-find "sleep"))
-  (with-temp-buffer
-    (let ((tempbuf (current-buffer)))
-      (with-temp-eshell
-       (eshell-insert-command (format "sleep 100 2> #<buffer %s>" tempbuf))
-       (kill-process (eshell-head-process))))
+  (eshell-with-temp-buffer bufname ""
+    (with-temp-eshell
+     (eshell-insert-command (format "sleep 100 2> #<buffer %s>" bufname))
+     (kill-process (eshell-head-process)))
     (should (equal (buffer-string) ""))))
 
 \f