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: Christopher M. Miles
Subject: Re: ob-shell sessions will send final echo '...' as input key sequence when previous command reads input interactively
Date: Mon, 01 May 2023 20:50:15 +0800
User-agent: mu4e 1.10.3; emacs 30.0.50

Ihor Radchenko <yantar92@posteo.net> writes:

> "Christopher M. Miles" <numbchild@gmail.com> writes:
>
>>> So, it looks to me like mpv is somehow trying to interpret "echo" commands 
>>> the
>>> ob-shell is sending after "mpv ...." is executed:
>> ...
>> Don't know ob-shell which part did your said "echo" commands. I don't
>> know where to dig this issue. Hope you can help. Thanks for your
>> reproducing problem and dive in.
>
> The underlying issue lies within how comint works + the fact that mpv
> reads key input from terminal.
>
> Try the following:
>
> 1. emacs -Q
> 2. M-x shell
> 3. cd /path/to/your/video <RET>
> 4. Copy the following into kill ring
> -----
> mpv "枕刀歌/《枕刀歌》SE05 江海阔 歌谣哼唱.mp4"
> m_
> -----
> 5. (in the shell buffer): C-y <RET>
> 6. Observe mpv playing no sound and video
> 7. Press m_ to restore video and sound.
>

I reproduced same now. Thanks for your guide.

> I am not sure if we can do much about this though.
> We run async shell commands in sessions using
>
> (insert (format ob-shell-async-indicator "start" uuid))
> (comint-send-input nil t)
> (insert (org-trim body))
> (comint-send-input nil t)
> (insert (format ob-shell-async-indicator "end" uuid))
> (comint-send-input nil t)
>
> which sends
>
> "echo '....'
> <your command>
> echo '...'"
>
> to comint terminal session.
>
> The last echo '...' in this case is interpreted as key input by mpv -
> symbol by symbol.
>
> The only way I know how to work around this is a giant one-liner like
> echo '....'; <your command>; echo '...'
>

I understand the process now, it is wrapped by ob-shell-async-indicator echo 
command.

> However, (1) ";" may not work in some shells; (2) <your command> may
> contain multiple lines, leading to the same issue.

I tested it (using ";") now, not working.

I might consider to use another language like python instead of sh to
execute command to play video to get around this issue. I will update
here if I success.

-- 

[ stardiviner ]
I try to make every word tell the meaning that I want to express without 
misunderstanding.

Blog: https://stardiviner.github.io/
IRC(libera.chat, freenode): stardiviner, Matrix: stardiviner
GPG: F09F650D7D674819892591401B5DF1C95AE89AC3

Attachment: signature.asc
Description: PGP signature


reply via email to

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