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. --