(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))
(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.
;; 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
(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"