emacs-orgmode
[Top][All Lists]
Advanced

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

Re: ob-shell sessions will send final echo '...' as input key sequence w


From: Ihor Radchenko
Subject: Re: ob-shell sessions will send final echo '...' as input key sequence when previous command reads input interactively (was: [Need Help] Error to evaluate "mpv" command in inline src block)
Date: Wed, 03 May 2023 10:41:32 +0000

Matt <matt@excalamus.com> writes:

>  > Matt, maybe you have some ideas about this edge case?
>
> I have no other ideas within the current ob-shell implementation.  As for 
> modifications, I have the following thoughts.
>
> First, how might we state the problem for this edge case?
>
> To me, it looks like, "How can the ob-shell :async option manage interactive 
> input?"  Do you agree with this formulation?  If not, how do you see it 
> differently?

It is not about :async per se. Rather about using :session.

A simple reproducer is

#+begin_src bash :session test
mpv "/path/to/some/video"
m_
#+end_src

Basically, when you send multiline command in comint buffer without
waiting for each line to finish, the following line may be read by the
running command if that command is interactive.

It is similar to a situation when you run a normal terminal like

$ mpv "..."
<now type "m_" while mpv is still running>
<exit mpv>
$ m_ <m_ is echoed in the next prompt>

> One thought is to update :async to work with the :stdin option so that
> the block is run as a script. Currently, :stdin runs synchronously in
> a separate shell. We might be able to grab the script's output and put
> it into the session buffer. See how the following runs in a temporary
> shell, regardless of the :session/:async options.

Avoiding session altogether will indeed solve the problem, as :session
is the place where the problem lies.

Adding :stdin support is also an interesting idea, even out of scope of
this discussion.

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
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

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