From f8a9cd23087799519bd709ea5c208ed29cb6587f Mon Sep 17 00:00:00 2001 From: Ihor Radchenko Date: Sun, 23 Oct 2022 12:22:25 +0800 Subject: [PATCH] org-babel-eval: Return command output even upon failure MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * lisp/ob-eval.el (org-babel-eval): Return the available command output even when the command fails. This is useful for bash scripts that can produce useful output even upon failing. The error window is still displayed to inform users. Reported-by: Rudolf Adamkovič Link: https://orgmode.org/list/m2czakgpk8.fsf@me.com --- lisp/ob-eval.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lisp/ob-eval.el b/lisp/ob-eval.el index fa27d98a9..25a994134 100644 --- a/lisp/ob-eval.el +++ b/lisp/ob-eval.el @@ -71,7 +71,8 @@ its results, otherwise display STDERR with (compilation-mode)) ;; Compilation-mode enforces read-only, but Babel expects the buffer modifiable. (setq buffer-read-only nil)))) - nil) + ;; Return output, if any. + (buffer-string)) (buffer-string))))) (defun org-babel-eval-read-file (file)