]> git.eshelyaron.com Git - emacs.git/commitdiff
* lisp/net/tramp.el (tramp-handle-shell-command): Modify sentinel handling.
authorMichael Albinus <michael.albinus@gmx.de>
Wed, 27 Jul 2022 17:55:18 +0000 (19:55 +0200)
committerMichael Albinus <michael.albinus@gmx.de>
Wed, 27 Jul 2022 17:55:18 +0000 (19:55 +0200)
lisp/net/tramp.el

index 0bfb770f5ed41b7153246d3ad1bbbe8cef84bc66..e1a45e4ad544dba08729cbe7e7e6e73010987fdc 100644 (file)
@@ -4865,11 +4865,13 @@ support symbolic links."
         (error-file
          (and error-buffer
               (with-parsed-tramp-file-name default-directory nil
-                (tramp-test-message "Holla1")
+                 (when (getenv "EMACS_EMBA_CI")
+                  (tramp-test-message "Holla1"))
                 (prog1
                     (tramp-make-tramp-file-name
                      v (tramp-make-tramp-temp-file v))
-                (tramp-test-message "Holla2")))))
+                   (when (getenv "EMACS_EMBA_CI")
+                    (tramp-test-message "Holla2"))))))
         (bname (buffer-name output-buffer))
         (p (get-buffer-process output-buffer))
         (dir default-directory)
@@ -4940,33 +4942,39 @@ support symbolic links."
              ;; Run the process.
              (setq p (start-file-process-shell-command
                       (buffer-name output-buffer) buffer command))
-           ;; Insert error messages if they were separated.
-           (when error-file
-             (tramp-test-message "Holla3")
-             (with-current-buffer error-buffer
-               (insert-file-contents-literally error-file))
-             (tramp-test-message "Holla4"))
-           (if (process-live-p p)
-               ;; Display output.
-               (with-current-buffer output-buffer
-                 (setq mode-line-process '(":%s"))
-                 (unless (eq major-mode 'shell-mode)
-                   (shell-mode))
-                 (set-process-filter p #'comint-output-filter)
-                 (set-process-sentinel p #'shell-command-sentinel)
-                 (when error-file
-                   (add-function
-                    :after (process-sentinel p)
-                    (lambda (_proc _string)
-                      (with-current-buffer error-buffer
-                        (insert-file-contents-literally
-                         error-file nil nil nil 'replace))
-                      (delete-file error-file))))
-                 (display-buffer output-buffer '(nil (allow-no-window . t))))
-
-             (when error-file
-               (delete-file error-file)))))
-
+           (when (process-live-p p)
+             ;; Display output.
+             (with-current-buffer output-buffer
+               (setq mode-line-process '(":%s"))
+               (unless (eq major-mode 'shell-mode)
+                 (shell-mode))
+               (set-process-filter p #'comint-output-filter)
+               (set-process-sentinel p #'shell-command-sentinel)
+               (when error-file
+                 (add-function
+                  :after (process-sentinel p)
+                  (lambda (_proc _string)
+                     (when (getenv "EMACS_EMBA_CI")
+                      (tramp-test-message "Holla3 %s" error-file))
+                    (with-current-buffer error-buffer
+                      (insert-file-contents-literally
+                       error-file nil nil nil 'replace))
+                     (when (getenv "EMACS_EMBA_CI")
+                      (tramp-test-message "Holla4 %s" error-file))
+                    (delete-file error-file))))
+               (display-buffer output-buffer '(nil (allow-no-window . t))))
+
+             ;; Insert error messages if they were separated.
+             (when (and error-file (not (process-live-p p)))
+                (when (getenv "EMACS_EMBA_CI")
+                 (tramp-test-message "Holla5 %s" error-file))
+               (with-current-buffer error-buffer
+                 (insert-file-contents-literally error-file))
+                (when (getenv "EMACS_EMBA_CI")
+                 (tramp-test-message "Holla6 %s" error-file))
+               (delete-file error-file)))))
+
+      ;; Synchronous case.
       (prog1
          ;; Run the process.
          (process-file-shell-command command nil buffer)