astahlman / ob-async

Asynchronous src_block execution for org-babel
343 stars 32 forks source link

ob-async does not work with tramp methods in :dir header argument #50

Closed stardiviner closed 5 years ago

stardiviner commented 5 years ago

Checklist

Expected Behavior

#+begin_src sh :dir /sudo:: :async
pwd
#+end_src

#+RESULTS:
: /

Actual Behavior

#+begin_src sh :dir /sudo:: :async
pwd
#+end_src

#+RESULTS:
: c3b1c8c713d89c0548ffb9d9e7bf50cf

It never returns. The process never ends.

Steps to Reproduce

#+begin_src sh :dir /sudo:: :async
pwd
#+end_src

Troubleshooting Artifacts

stardiviner commented 5 years ago

This might also should work with other TRAMP methods like /docker:, /su:, /ssh: etc.

astahlman commented 5 years ago

Have you tried executing that block without :async? I just did, and it also hangs for me.

#+begin_src sh :dir /sudo::
pwd
#+end_src

This is in the Messages:

Tramp: Opening connection for root@<hostname-redacted> using sudo...
Tramp: Sending command ‘exec env SHELL=/bin/sh sudo -u root -s -H -p P""a""s""s""w""o""r""d"":’
Tramp: Waiting for prompts from remote shell...
Tramp: Sending Password
Tramp: Waiting for prompts from remote shell...failed
Tramp: Opening connection for root@<hostname-redacted> using sudo...failed

I just confirmed that it works with this syntax:

#+BEGIN_SRC sh :async :dir "/sudo:andrewstahlman@localhost:/"
   echo $SUDO_USER $PWD
#+END_SRC

#+RESULTS:
: andrewstahlman /

And we have a unit test for this which is passing as well: https://github.com/astahlman/ob-async/blob/f52447d91dcfe08e870e2a9d1e03e0c45a7237a3/test/ob-async-test.el#L230-L242

stardiviner commented 5 years ago

Thanks, I see. This is solved.

ghost commented 7 months ago

Hi, I am not able to use ob-async to execute command on remote servers.

#+BEGIN_SRC sh :async :dir "/sudo:sahil@192.168.122.90:/"
   echo $SUDO_USER $PWD
#+END_SRC

#+RESULTS:
: fd6e1e40ecf7ba31d30e25c2cb03b31f

It returns with error that the provided host doesn't match some regexp. Have you hard coded it to only run against localhost?