org-babel-sh-evaluate: Fix edge case when :shebang is set and :dir is remote
* lisp/ob-shell.el (org-babel-sh-evaluate): Pass remote local file name as command when executing script with :shebang. `org-babel-eval' will fail when SCRIPT-FILE is TRAMP file name. Link: https://www.reddit.com/r/orgmode/comments/14zh2yi/orgbabel_shebang_not_working_on_with_tramp_dir/
This commit is contained in:
parent
ef391c882c
commit
39de4a1848
|
@ -357,7 +357,13 @@ return the value of the last statement in BODY."
|
|||
(when padline (insert "\n"))
|
||||
(insert body))
|
||||
(set-file-modes script-file #o755)
|
||||
(org-babel-eval script-file "")))
|
||||
(if (file-remote-p script-file)
|
||||
;; Run remote script using its local path as COMMAND.
|
||||
;; The remote execution is ensured by setting
|
||||
;; correct `default-directory'.
|
||||
(let ((default-directory (file-name-directory script-file)))
|
||||
(org-babel-eval (file-local-name script-file) ""))
|
||||
(org-babel-eval script-file ""))))
|
||||
(t (org-babel-eval shell-file-name (org-trim body))))))
|
||||
(when (and results value-is-exit-status)
|
||||
(setq results (car (reverse (split-string results "\n" t)))))
|
||||
|
|
Loading…
Reference in New Issue