[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[O] org-babel: capturing the output of a shell command that does not ret
From: |
garjola |
Subject: |
[O] org-babel: capturing the output of a shell command that does not return |
Date: |
Wed, 19 Sep 2018 22:34:22 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux) |
Hi,
I need to capture the output of a shell command run from a babel code block,
but this command does not return. By that, I mean that the command prints some
text to the terminal, but does not end (it launches a deamon). Something like
this:
#+BEGIN_SRC bash
jupyter kernel
#+END_SRC
When run in a terminal, the command outputs some text like:
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> > >
> [KernelApp] Starting kernel 'python3'
> >
> [KernelApp] Connection file:
> /run/user/1000/jupyter/kernel-8a5cf00c-182c-4212-9bbc-7aa6ec436b95.json >
> [KernelApp] To connect a client: --existing
> kernel-8a5cf00c-182c-4212-9bbc-7aa6ec436b95.json >
> >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> >>
> >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> > >
and sits there waiting for requests. I would like to capture the output to
parse it. I need the name of the json file to pass it as a :session argument to
subsequent code blocks like this:
#+BEGIN_SRC emacs-lisp
(setq org-babel-default-header-args
(cons '(:session .
"/run/user/1000/jupyter/kernel-8a5cf00c-182c-4212-9bbc-7aa6ec436b95.json")
(assq-delete-all :session org-babel-default-header-args)))
#+END_SRC
#+BEGIN_SRC ipython :results output drawer :session
"/run/user/1000/jupyter/kernel-8a5cf00c-182c-4212-9bbc-7aa6ec436b95.json"
print(2+2)
#+END_SRC
Maybe there is another way to run the shell command and extract the file name I
need (in elisp?), but I don't know how.
I anybody could point me in the right direction, this would be very helpful.
Thank you.
G.
--
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [O] org-babel: capturing the output of a shell command that does not return,
garjola <=