mirror of
https://git.savannah.gnu.org/git/emacs/org-mode.git
synced 2024-09-29 18:36:26 +00:00
ob-shell.el: Use the exit status as the default result
* lisp/ob-shell.el (org-babel-execute:shell) (org-babel-sh-evaluate): Use the exit code as the value and, consequently, as the result when no :results header is set. See this thread: https://orgmode.org/list/CA+A2iZaziAfMeGpBqL6qGrzrWEVvLvC0DUw++T4gCF3NGuW-DQ@mail.gmail.com/ And Tim's useful summary here: https://orgmode.org/list/87sgiszqc1.fsf@gmail.com/ This commit resolves the issue by deciding not to make an exception for ob-shell.el: - the "value" of executing a shell/bash script is the exit code - when no :results header is set, use the value as the result - use :results output to use the stdout
This commit is contained in:
parent
d03a52d37b
commit
2f53429413
|
@ -80,7 +80,7 @@ This function is called by `org-babel-execute-src-block'."
|
|||
(when stdin (org-babel-sh-var-to-string
|
||||
(org-babel-ref-resolve stdin)))))
|
||||
(value-is-exit-status
|
||||
(member "value" (cdr (assq :result-params params))))
|
||||
(not (member "output" (cdr (assq :result-params params)))))
|
||||
(cmdline (cdr (assq :cmdline params)))
|
||||
(full-body (concat
|
||||
(org-babel-expand-body:generic
|
||||
|
@ -214,7 +214,7 @@ of the statements in BODY, if RESULT-TYPE equals `value' then
|
|||
return the value of the last statement in BODY."
|
||||
(let* ((shebang (cdr (assq :shebang params)))
|
||||
(value-is-exit-status
|
||||
(member "value" (cdr (assq :result-params params))))
|
||||
(not (member "output" (cdr (assq :result-params params)))))
|
||||
(results
|
||||
(cond
|
||||
((or stdin cmdline) ; external shell script w/STDIN
|
||||
|
|
Loading…
Reference in a new issue