>From ed579eaaaaf4fd6a0b78a8c52a897eaa5cb322de Mon Sep 17 00:00:00 2001 From: "George D. Plymale II" Date: Thu, 20 Apr 2017 14:05:11 -0400 Subject: [PATCH] Fix for bug#26161 * `eshell-exit-success-p' has been changed to only check if the last exit code was zero, rather than first checking whether the last command returned nil. * `eshell-exec-lisp' has been changed so that it will set `eshell-last-command-status' to 1 if it catches an error. * These changes together make it so that the `&&' operator in Eshell behaves more expectedly to someone who has used a bash-like shell and so that other things involving the success of Lisp commands in Eshell are more reliable. --- lisp/eshell/esh-cmd.el | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/lisp/eshell/esh-cmd.el b/lisp/eshell/esh-cmd.el index d3613d3140..53a266d149 100644 --- a/lisp/eshell/esh-cmd.el +++ b/lisp/eshell/esh-cmd.el @@ -575,14 +575,9 @@ eshell-rewrite-if-command (defvar eshell-last-command-result) ;Defined in esh-io.el. (defun eshell-exit-success-p () - "Return non-nil if the last command was \"successful\". -For a bit of Lisp code, this means a return value of non-nil. -For an external command, it means an exit code of 0." - (if (save-match-data - (string-match "#<\\(Lisp object\\|function .*\\)>" - eshell-last-command-name)) - eshell-last-command-result - (= eshell-last-command-status 0))) + "Return non-nil if the last command was successful. +This means an exit code of 0." + (= eshell-last-command-status 0)) (defvar eshell--cmd) @@ -1257,6 +1252,7 @@ eshell-exec-lisp (and result (funcall printer result)) result) (error + (setq eshell-last-command-status 1) (let ((msg (error-message-string err))) (if (and (not form-p) (string-match "^Wrong number of arguments" msg) -- 2.11.0 (Apple Git-81)