XEmacs 21.2.4
[chise/xemacs-chise.git.1] / lisp / process.el
index fb46f35..1c93601 100644 (file)
@@ -245,6 +245,7 @@ In either case, the output is inserted after point (leaving mark after it)."
     (let ((buffer (get-buffer-create
                   (or output-buffer "*Shell Command Output*")))
          (success nil)
+         (exit-status nil)
          (directory default-directory))
       (unwind-protect
          (if (eq buffer (current-buffer))
@@ -254,9 +255,10 @@ In either case, the output is inserted after point (leaving mark after it)."
              (progn (setq buffer-read-only nil)
                     (delete-region (max start end) (point-max))
                     (delete-region (point-min) (max start end))
-                    (call-process-region (point-min) (point-max)
-                                         shell-file-name t t nil
-                                         shell-command-switch command)
+                    (setq exit-status
+                          (call-process-region (point-min) (point-max)
+                                               shell-file-name t t nil
+                                               shell-command-switch command))
                     (setq success t))
            ;; Clear the output buffer, 
            ;; then run the command with output there.
@@ -266,9 +268,10 @@ In either case, the output is inserted after point (leaving mark after it)."
              ;; XEmacs change
              (setq default-directory directory)
              (erase-buffer))
-           (call-process-region start end shell-file-name
-                                nil buffer nil
-                                shell-command-switch command)
+           (setq exit-status
+                 (call-process-region start end shell-file-name
+                                      nil buffer nil
+                                      shell-command-switch command))
            (setq success t))
        ;; Report the amount of output.
        (let ((lines (save-excursion
@@ -280,7 +283,9 @@ In either case, the output is inserted after point (leaving mark after it)."
                 (if success
                     (display-message
                      'command
-                     "(Shell command completed with no output)"))
+                     (if (eql exit-status 0)
+                         "(Shell command succeeded with no output)"
+                       "(Shell command failed with no output)")))
                 (kill-buffer buffer))
                ((and success (= lines 1))
                 (message "%s"