"Tyler Smith" <[email protected]> writes:

> I'm trying to update ob-awk.el to allow for code to be executed on remote 
> machines. This doesn't seem to work at present:
>
> #+begin_src awk :dir /ssh:gpsc:data/rubus 
>   END { print "I ran!"}
> #+end_src
>
> : awk: fatal: cannot open source file `/ssh:gpsc:/home/tys000/awk-oQ0Av9' for 
> reading: No such file : or directory
> : [ Babel evaluation exited with code 2 ]
>
> Digging through the code, particularly ~org-babel-execute:awk~ in the file 
> ~ob-awk.el~, I think the issue is the code chunk is stored as a temporary 
> file on the remote machine, and then we try to run awk on the remote machine 
> with the path to the code file *relative to my local machine*. i.e.,
>
>     awk -f /ssh:gpsc:/home/tys000/awk-qSxjHH
>
> I don't think Awk can process paths in this format in any case.
>
> I've come up with a solution. Instead of saving the code to a temporary file, 
> we could just pass the code chunk as a string to awk. In the body of 
> ~org-babel-execute:awk~ the awk command is constructed like this:
> ...
> ...
> After some limited testing, this seems to work. Does that sound like a good 
> approach?

I think a simpler solution would be using `org-babel-process-file-name'.

-- 
Ihor Radchenko // yantar92,
Org mode maintainer,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>

Reply via email to