emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] [BUG] remote execution in heterogeneous environment


From: Michael Albinus
Subject: Re: [O] [BUG] remote execution in heterogeneous environment
Date: Tue, 08 Jan 2013 09:36:55 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux)

Achim Gratz <address@hidden> writes:

>> +  (let ((input-file (org-babel-temp-file "input-"))
>> +    (error-file (if error-buffer (org-babel-temp-file "scor-") nil))
>> +    (shell-file-name
>> +     (if (file-executable-p
>> +          (concat (file-remote-p default-directory) shell-file-name))
>> +         shell-file-name
>> +       "/bin/sh"))
>
> The hard-coded /bin/sh breaks testing with NT-Emacs and using Cygwin as
> the backend because of the different path conventions in both
> environments.  This is a hack, but it works when setting SHELL=dash,
> note that there are no path components in there and even if your test
> would fail: NTEmacs knows nothing about Cygwin's path.  Can you please
> arrange that shell-file-name is used without alteration when the
> execution is local?  Even for remote execution hardcoding /bin/sh seems
> a bit heavy-handed to me…

What about this:

--8<---------------cut here---------------start------------->8---
--- a/lisp/ob-eval.el
+++ b/lisp/ob-eval.el
@@ -137,11 +137,17 @@ specifies the value of ERROR-BUFFER."
                       t)))
   (let ((input-file (org-babel-temp-file "input-"))
        (error-file (if error-buffer (org-babel-temp-file "scor-") nil))
+       ;; Unfortunately, `executable-find' does not support file name
+       ;; handlers.  Therefore, we could use it in the local case
+       ;; only.
        (shell-file-name
-        (if (file-executable-p
-             (concat (file-remote-p default-directory) shell-file-name))
-            shell-file-name
-          "/bin/sh"))
+        (cond ((and (not (file-remote-p default-directory))
+                    (executable-find shell-file-name))
+               shell-file-name)
+              ((file-executable-p
+                (concat (file-remote-p default-directory) shell-file-name))
+               shell-file-name)
+              ("/bin/sh")))
        exit-status)
     ;; There is an error in `process-file' when `error-file' exists.
     ;; This is fixed in Emacs trunk as of 2012-12-21; let's use this
--8<---------------cut here---------------end--------------->8---

The use of "/bin/sh" as fallback should be OK. In the local case, the
first cond clause shall be selected (otherwise there is something really
wrong). And for remote execution, "/bin/sh" should exist execept in case
of remote MS Windows or Android devices. Once you want run shells from
org there, we could even tweak this :-)

> Regards,
> Achim.

Best regards, Michael.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]