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)

2023-05-03 Thread Ihor Radchenko
Matt  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 "..."


$ m_ 

> 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 .
Support Org development at ,
or support my work at 



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)

2023-05-02 Thread Matt
  On Tue, 02 May 2023 00:17:51 -0400  Christopher M. Miles  wrote --- 

 > Indeed, this option solved the problem real neat.
 > I'm surprised by your knowledge and digging problem skill.
 > I have to say a big TANKS to you. THANKS, THANKS, THANKS. Hahaha

My thanks as well to everyone who helped.  I'm tied up with personal matters 
currently and am only seeing this thread now.

  On Mon, 01 May 2023 07:36:23 -0400  Ihor Radchenko  wrote --- 
 
 > The only way I know how to work around this is a giant one-liner like
 > echo ''; ; echo '...'
 > 
 > However, (1) ";" may not work in some shells; (2)  may
 > contain multiple lines, leading to the same issue.
 > 
 > 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?

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.

#+name: answers
Matt
yes

#+begin_src sh :stdin answers :results output :session *test* :async
echo -n "What's your name?"
read -r name
echo
echo "Hello, $name!"

echo -n "Would you like to continue?"
read -r continue
echo

if [ $continue == 'yes' ]; then
echo "Continuing..."
sleep 3
echo "Process complete"
else
echo "Aborted"
fi
#+end_src

#+RESULTS:
: What's your name?
: Hello, Matt!
: Would you like to continue?
: Continuing...
: Process complete



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)

2023-05-01 Thread Ihor Radchenko
"Christopher M. Miles"  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 
4. Copy the following into kill ring
-
mpv "枕刀歌/《枕刀歌》SE05 江海阔 歌谣哼唱.mp4"
m_
-
5. (in the shell buffer): C-y 
6. Observe mpv playing no sound and video
7. Press m_ to restore video and sound.

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

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 ''; ; echo '...'

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

Matt, maybe you have some ideas about this edge case?

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at .
Support Org development at ,
or support my work at 



Re: [Need Help] Error to evaluate "mpv" command in inline src block

2023-05-01 Thread Christopher M. Miles

Ihor Radchenko  writes:

> "Christopher M. Miles"  writes:
>
 But I failed to execute mpv command:

 #+begin_src org
 Test src_sh{mpv "枕刀歌/《枕刀歌》SE05 江海阔 歌谣哼唱.mp4"}
 #+end_src
>>>
>>> May you elaborate what you mean by "failed"?
>>
>> The "failed" means the MPV video player window does not show up, no video, 
>> no audio.
>
> Interesting. I tried harder to reproduce following your steps.
> Now, I used a video file with CJK name:
>
> * 《枕刀歌》
> :PROPERTIES:
> :DATE: [2021-05-13 Thu 20:09]
> :Douban:   https://movie.douban.com/subject/35350794/
> :DIR:  鸟瞰古
> :EVAL: src_sh{mpv "鸟瞰古/【人文纪录片】鸟瞰古代中国.Ancient.China.from.Above P1 
> 鸟瞰古代中国.Ancient.China.from.Above.S01flv"}
> :END:
>
> And I can reproduce - mpv windows shows up, but no video and no sound.
> Then, I tried to open the same video in usual way... and still no sound
> - until I press "m" to unmute.
>
> So, it looks to me like mpv is somehow trying to interpret "echo" commands the
> ob-shell is sending after "mpv " is executed:
>
> ob_comint_async_shell_start_d1cc7563-be0c-4ed0-a4c2-d1b545333983
> org_babel_sh_prompt> =[input] No key binding found for key 'c'.
> ...
> [input] No key binding found for key '''.
> [input] No key binding found for key 'b'.
> ...
> [input] No key binding found for key '''.
>
> These "No key binding found statements" a likely from "echo" commands
> attempted to be sent to the terminal.

Do you think this issue is from Emacs shell part or mpv part?

-- 

[ 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


signature.asc
Description: PGP signature


Re: [Need Help] Error to evaluate "mpv" command in inline src block

2023-05-01 Thread Christopher M. Miles

Ihor Radchenko  writes:

> "Christopher M. Miles"  writes:
>
 But I failed to execute mpv command:

 #+begin_src org
 Test src_sh{mpv "枕刀歌/《枕刀歌》SE05 江海阔 歌谣哼唱.mp4"}
 #+end_src
>>>
>>> May you elaborate what you mean by "failed"?
>>
>> The "failed" means the MPV video player window does not show up, no video, 
>> no audio.
>
> Interesting. I tried harder to reproduce following your steps.
> Now, I used a video file with CJK name:
>
> * 《枕刀歌》
> :PROPERTIES:
> :DATE: [2021-05-13 Thu 20:09]
> :Douban:   https://movie.douban.com/subject/35350794/
> :DIR:  鸟瞰古
> :EVAL: src_sh{mpv "鸟瞰古/【人文纪录片】鸟瞰古代中国.Ancient.China.from.Above P1 
> 鸟瞰古代中国.Ancient.China.from.Above.S01flv"}
> :END:
>
> And I can reproduce - mpv windows shows up, but no video and no sound.
> Then, I tried to open the same video in usual way... and still no sound
> - until I press "m" to unmute.
>
> So, it looks to me like mpv is somehow trying to interpret "echo" commands the
> ob-shell is sending after "mpv " is executed:
>
> ob_comint_async_shell_start_d1cc7563-be0c-4ed0-a4c2-d1b545333983
> org_babel_sh_prompt> =[input] No key binding found for key 'c'.
> ...
> [input] No key binding found for key '''.
> [input] No key binding found for key 'b'.
> ...
> [input] No key binding found for key '''.
>
> These "No key binding found statements" a likely from "echo" commands
> attempted to be sent to the terminal.

I have similar output in session buffer too. Here is the output in my session 
buffer.

When I press Tab key to expand upper headline. I check the inline src block 
session buffer, here is the output:

#+begin_example
bash-5.2$ bash-5.2$ PROMPT_COMMAND=;PS1="org_babel_sh_prompt> ";PS2=
org_babel_sh_prompt> echo 
'ob_comint_async_shell_start_d1cc7563-be0c-4ed0-a4c2-d1b545333983'
mpv "枕刀歌/《枕刀歌》SE05 江海阔 歌谣哼唱.mp4"
echo 'ob_comint_async_shell_end_d1cc7563-be0c-4ed0-a4c2-d1b545333983'
ob_comint_async_shell_start_d1cc7563-be0c-4ed0-a4c2-d1b545333983
org_babel_sh_prompt> =[input] No key binding found for key 'c'.
[input] No key binding found for key 'h'.
[input] No key binding found for key '''.
[input] No key binding found for key 'b'.
[input] No key binding found for key 'c'.
[input] No key binding found for key 'n'.
[input] No key binding found for key 'a'.
[input] No key binding found for key 'y'.
[input] No key binding found for key 'n'.
[input] No key binding found for key 'c'.
[input] No key binding found for key 'h'.
[input] No key binding found for key 'n'.
[input] No key binding found for key 'c'.
[input] No key binding found for key 'c'.
[input] No key binding found for key '-'.
[input] No key binding found for key 'b'.
[input] No key binding found for key 'c'.
[input] No key binding found for key '-'.
[input] No key binding found for key '-'.
[input] No key binding found for key 'a'.
[input] No key binding found for key 'c'.
[input] No key binding found for key '-'.
[input] No key binding found for key 'b'.
[input] No key binding found for key '''.

Resuming playback. This behavior can be disabled with --no-resume-playback.

 Video --vid=1 (*) (h264 1920x1080 25.000fps)
 (+) Audio --aid=1 (*) (aac 2ch 48000Hz)
AO: [coreaudio] 48000Hz stereo 2ch floatp
Mute: yes



  C-c C-c>
Saving state.

Exiting... (Quit)
org_babel_sh_prompt> echo $SHELL 
/bin/zsh
org_babel_sh_prompt> 
#+end_example


I also try to add "sleep 1;" command before "mpv ..." command to delay
mpv executing. Still not success.

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.

-- 

[ 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


signature.asc
Description: PGP signature


Re: [Need Help] Error to evaluate "mpv" command in inline src block

2023-05-01 Thread Ihor Radchenko
"Christopher M. Miles"  writes:

>>> But I failed to execute mpv command:
>>>
>>> #+begin_src org
>>> Test src_sh{mpv "枕刀歌/《枕刀歌》SE05 江海阔 歌谣哼唱.mp4"}
>>> #+end_src
>>
>> May you elaborate what you mean by "failed"?
>
> The "failed" means the MPV video player window does not show up, no video, no 
> audio.

Interesting. I tried harder to reproduce following your steps.
Now, I used a video file with CJK name:

* 《枕刀歌》
:PROPERTIES:
:DATE: [2021-05-13 Thu 20:09]
:Douban:   https://movie.douban.com/subject/35350794/
:DIR:  鸟瞰古
:EVAL: src_sh{mpv "鸟瞰古/【人文纪录片】鸟瞰古代中国.Ancient.China.from.Above P1 
鸟瞰古代中国.Ancient.China.from.Above.S01flv"}
:END:

And I can reproduce - mpv windows shows up, but no video and no sound.
Then, I tried to open the same video in usual way... and still no sound
- until I press "m" to unmute.

So, it looks to me like mpv is somehow trying to interpret "echo" commands the
ob-shell is sending after "mpv " is executed:

ob_comint_async_shell_start_d1cc7563-be0c-4ed0-a4c2-d1b545333983
org_babel_sh_prompt> =[input] No key binding found for key 'c'.
...
[input] No key binding found for key '''.
[input] No key binding found for key 'b'.
...
[input] No key binding found for key '''.

These "No key binding found statements" a likely from "echo" commands
attempted to be sent to the terminal.

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at .
Support Org development at ,
or support my work at 



Re: [Need Help] Error to evaluate "mpv" command in inline src block

2023-04-30 Thread Christopher M. Miles

Ihor Radchenko  writes:

> stardiviner  writes:
>
>> I have Emacs Org mode config like bellowing to auto evaluate inline src
>> block when Org headline cycle expanded.
>> ...
>> Here is the testing Org content:
>> ...
>>
>> When I press Tab key to expand upper headline. I check the inline src block
>> session buffer, here is the output:
>>
>> #+begin_example
>> bash-5.2$ bash-5.2$ PROMPT_COMMAND=;PS1="org_babel_sh_prompt> ";PS2=
>> org_babel_sh_prompt> echo
>> 'ob_comint_async_shell_start_d1cc7563-be0c-4ed0-a4c2-d1b545333983'
>> mpv "枕刀歌/《枕刀歌》SE05 江海阔 歌谣哼唱.mp4"
>> echo 'ob_comint_async_shell_end_d1cc7563-be0c-4ed0-a4c2-d1b545333983'
>> ob_comint_async_shell_start_d1cc7563-be0c-4ed0-a4c2-d1b545333983
>> org_babel_sh_prompt> =[input] No key binding found for key 'c'.
>> ...
>> Resuming playback. This behavior can be disabled with --no-resume-playback.
>>
>>  Video --vid=1 (*) (h264 1920x1080 25.000fps)
>>  (+) Audio --aid=1 (*) (aac 2ch 48000Hz)
>> AO: [coreaudio] 48000Hz stereo 2ch floatp
>> Mute: yes
>>
>>
>>
>>   C-c C-c>
>> Saving state.
>>
>> Exiting... (Quit)
>> org_babel_sh_prompt> echo $SHELL
>> /bin/zsh
>> org_babel_sh_prompt>
>> #+end_example
>
> It looks like mpv command is running.
>

Yes, check out the output from the sh session buffer, we can confirm mpv is 
executed.
But seems got weird error.

>> ...
>> But I failed to execute mpv command:
>>
>> #+begin_src org
>> Test src_sh{mpv "枕刀歌/《枕刀歌》SE05 江海阔 歌谣哼唱.mp4"}
>> #+end_src
>
> May you elaborate what you mean by "failed"?

The "failed" means the MPV video player window does not show up, no video, no 
audio.

-- 

[ 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


signature.asc
Description: PGP signature


Re: [Need Help] Error to evaluate "mpv" command in inline src block

2023-04-30 Thread Ihor Radchenko
stardiviner  writes:

> I have Emacs Org mode config like bellowing to auto evaluate inline src
> block when Org headline cycle expanded.
> ...
> Here is the testing Org content:
> ...
>
> When I press Tab key to expand upper headline. I check the inline src block
> session buffer, here is the output:
>
> #+begin_example
> bash-5.2$ bash-5.2$ PROMPT_COMMAND=;PS1="org_babel_sh_prompt> ";PS2=
> org_babel_sh_prompt> echo
> 'ob_comint_async_shell_start_d1cc7563-be0c-4ed0-a4c2-d1b545333983'
> mpv "枕刀歌/《枕刀歌》SE05 江海阔 歌谣哼唱.mp4"
> echo 'ob_comint_async_shell_end_d1cc7563-be0c-4ed0-a4c2-d1b545333983'
> ob_comint_async_shell_start_d1cc7563-be0c-4ed0-a4c2-d1b545333983
> org_babel_sh_prompt> =[input] No key binding found for key 'c'.
> ...
> Resuming playback. This behavior can be disabled with --no-resume-playback.
>
>  Video --vid=1 (*) (h264 1920x1080 25.000fps)
>  (+) Audio --aid=1 (*) (aac 2ch 48000Hz)
> AO: [coreaudio] 48000Hz stereo 2ch floatp
> Mute: yes
>
>
>
>   C-c C-c>
> Saving state.
>
> Exiting... (Quit)
> org_babel_sh_prompt> echo $SHELL
> /bin/zsh
> org_babel_sh_prompt>
> #+end_example

It looks like mpv command is running.

> ...
> But I failed to execute mpv command:
>
> #+begin_src org
> Test src_sh{mpv "枕刀歌/《枕刀歌》SE05 江海阔 歌谣哼唱.mp4"}
> #+end_src

May you elaborate what you mean by "failed"?

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at .
Support Org development at ,
or support my work at 



Re: [Need Help] Error to evaluate "mpv" command in inline src block

2023-04-30 Thread Christopher M. Miles

Ruijie Yu  writes:

> Try putting "cat" there.  I suspect something is fed into the stdin of
> the process.

Can you explain in detailed? Don't know how to put command "cat" in my 
situation.

-- 

[ 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


signature.asc
Description: PGP signature


Re: [Need Help] Error to evaluate "mpv" command in inline src block

2023-04-29 Thread General discussions about Org-mode.


stardiviner  writes:

> I have example Org file like bellowing.
>
> Here is the testing Org content:
>
> #+begin_src org
> ,* 《枕刀歌》
> :PROPERTIES:
> :DATE: [2021-05-13 Thu 20:09]
> :Douban:   https://movie.douban.com/subject/35350794/
> :DIR:  枕刀歌
> :EVAL: src_sh{mpv "枕刀歌/《枕刀歌》SE05 江海阔 歌谣哼唱.mp4"}
> :END:
> #+end_src
>
> When I press Tab key to expand upper headline. I check the inline src block 
> session buffer, here is the output:
>
> #+begin_example
> bash-5.2$ bash-5.2$ PROMPT_COMMAND=;PS1="org_babel_sh_prompt> ";PS2=
> org_babel_sh_prompt> echo 
> 'ob_comint_async_shell_start_d1cc7563-be0c-4ed0-a4c2-d1b545333983'
> mpv "枕刀歌/《枕刀歌》SE05 江海阔 歌谣哼唱.mp4"
> echo 'ob_comint_async_shell_end_d1cc7563-be0c-4ed0-a4c2-d1b545333983'
> ob_comint_async_shell_start_d1cc7563-be0c-4ed0-a4c2-d1b545333983
> org_babel_sh_prompt> =[input] No key binding found for key 'c'.
> [input] No key binding found for key 'h'.
> [input] No key binding found for key '''.
> [input] No key binding found for key 'b'.
> [input] No key binding found for key 'c'.
> [input] No key binding found for key 'n'.
> [input] No key binding found for key 'a'.
> [input] No key binding found for key 'y'.
> [input] No key binding found for key 'n'.
> [input] No key binding found for key 'c'.
> [input] No key binding found for key 'h'.
> [input] No key binding found for key 'n'.
> [input] No key binding found for key 'c'.
> [input] No key binding found for key 'c'.
> [input] No key binding found for key '-'.
> [input] No key binding found for key 'b'.
> [input] No key binding found for key 'c'.
> [input] No key binding found for key '-'.
> [input] No key binding found for key '-'.
> [input] No key binding found for key 'a'.
> [input] No key binding found for key 'c'.
> [input] No key binding found for key '-'.
> [input] No key binding found for key 'b'.
> [input] No key binding found for key '''.
>
> Resuming playback. This behavior can be disabled with --no-resume-playback.
>
>  Video --vid=1 (*) (h264 1920x1080 25.000fps)
>  (+) Audio --aid=1 (*) (aac 2ch 48000Hz)
> AO: [coreaudio] 48000Hz stereo 2ch floatp
> Mute: yes
>
>   C-c C-c>
> Saving state.
>
> Exiting... (Quit)
> org_babel_sh_prompt> echo $SHELL 
> /bin/zsh
> org_babel_sh_prompt> 
> #+end_example
>
> Then I try to replace the "mpv" shell command with another command without 
> need to invoke desktop GUI. Like bellowing Org content:
>
> #+begin_src org
> ,* 《枕刀歌》
> :PROPERTIES:
> :DATE: [2021-05-13 Thu 20:09]
> :Douban:   https://movie.douban.com/subject/35350794/
> :DIR:  枕刀歌
> :EVAL: src_sh{sleep 10; echo "done"}
> :END:
> #+end_src
>
> It evaluated fine.

Try putting "cat" there.  I suspect something is fed into the stdin of
the process.

-- 
Best,


RY

[Please note that this mail might go to spam due to some
misconfiguration in my mail server -- still investigating.]



[Need Help] Error to evaluate "mpv" command in inline src block

2023-04-29 Thread stardiviner
*** Reproduce and experience log

I have Emacs Org mode config like bellowing to auto evaluate inline src
block when Org headline cycle expanded.

#+begin_src emacs-lisp
;;; auto evaluate inline source block in property "EVAL".

(defcustom org-property-eval-keyword "EVAL"
  "A property keyword for evaluate code."
  :type 'string
  :safe #'stringp
  :group 'org)

(add-to-list 'org-default-properties org-property-eval-keyword)

(defun org-property-eval-on-cycle-expand ( state)
  "Evaluate Org inline source block in property value on headline cycle
expand."
  (when (memq state '(children subtree))
(if-let ((inline-src-block (org-entry-get nil org-property-eval-keyword
nil)))
(with-temp-buffer
  (insert inline-src-block)
  (goto-char (point-min))
  (let* ((context (org-element-context))
 (lang (org-element-property :language context))
 (type (org-element-type context))
 (src-block-info (org-babel-get-src-block-info nil
context)))
(when (eq type 'inline-src-block)
  (org-babel-execute-src-block
   nil src-block-info
   (pcase lang
 ("sh" `((:session . ,(make-temp-name " *ob-sh-inline-async
(sh) ")) (:async . "yes") (:results . "silent")))
 ("shell" `((:session . ,(make-temp-name "
*ob-sh-inline-async (shell) ")) (:async . "yes") (:results . "silent")))
 ("bash" `((:session . ,(make-temp-name "
*ob-sh-inline-async (bash) ")) (:async . "yes") (:results . "silent")))
 ("zsh" `((:session . ,(make-temp-name "
*ob-sh-inline-async (zsh) ")) (:async . "yes") (:results . "silent")))
 (_ '((:results . "none")))

(add-hook 'org-cycle-hook #'org-property-eval-on-cycle-expand)
#+end_src

I have example Org file like bellowing.

Here is the testing Org content:

#+begin_src org
,* 《枕刀歌》
:PROPERTIES:
:DATE: [2021-05-13 Thu 20:09]
:Douban:   https://movie.douban.com/subject/35350794/
:DIR:  枕刀歌
:EVAL: src_sh{mpv "枕刀歌/《枕刀歌》SE05 江海阔 歌谣哼唱.mp4"}
:END:
#+end_src

When I press Tab key to expand upper headline. I check the inline src block
session buffer, here is the output:

#+begin_example
bash-5.2$ bash-5.2$ PROMPT_COMMAND=;PS1="org_babel_sh_prompt> ";PS2=
org_babel_sh_prompt> echo
'ob_comint_async_shell_start_d1cc7563-be0c-4ed0-a4c2-d1b545333983'
mpv "枕刀歌/《枕刀歌》SE05 江海阔 歌谣哼唱.mp4"
echo 'ob_comint_async_shell_end_d1cc7563-be0c-4ed0-a4c2-d1b545333983'
ob_comint_async_shell_start_d1cc7563-be0c-4ed0-a4c2-d1b545333983
org_babel_sh_prompt> =[input] No key binding found for key 'c'.
[input] No key binding found for key 'h'.
[input] No key binding found for key '''.
[input] No key binding found for key 'b'.
[input] No key binding found for key 'c'.
[input] No key binding found for key 'n'.
[input] No key binding found for key 'a'.
[input] No key binding found for key 'y'.
[input] No key binding found for key 'n'.
[input] No key binding found for key 'c'.
[input] No key binding found for key 'h'.
[input] No key binding found for key 'n'.
[input] No key binding found for key 'c'.
[input] No key binding found for key 'c'.
[input] No key binding found for key '-'.
[input] No key binding found for key 'b'.
[input] No key binding found for key 'c'.
[input] No key binding found for key '-'.
[input] No key binding found for key '-'.
[input] No key binding found for key 'a'.
[input] No key binding found for key 'c'.
[input] No key binding found for key '-'.
[input] No key binding found for key 'b'.
[input] No key binding found for key '''.

Resuming playback. This behavior can be disabled with --no-resume-playback.

 Video --vid=1 (*) (h264 1920x1080 25.000fps)
 (+) Audio --aid=1 (*) (aac 2ch 48000Hz)
AO: [coreaudio] 48000Hz stereo 2ch floatp
Mute: yes



  C-c C-c>
Saving state.

Exiting... (Quit)
org_babel_sh_prompt> echo $SHELL
/bin/zsh
org_babel_sh_prompt>
#+end_example

Then I try to replace the "mpv" shell command with another command without
need to invoke desktop GUI. Like bellowing Org content:

#+begin_src org
,* 《枕刀歌》
:PROPERTIES:
:DATE: [2021-05-13 Thu 20:09]
:Douban:   https://movie.douban.com/subject/35350794/
:DIR:  枕刀歌
:EVAL: src_sh{sleep 10; echo "done"}
:END:
#+end_src

It evaluated fine.

#+begin_example
sh-3.2$ sh-3.2$ PROMPT_COMMAND=;PS1="org_babel_sh_prompt> ";PS2=
org_babel_sh_prompt> echo
'ob_comint_async_shell_start_ca48d711-c1d3-4ec3-8e9b-072f76fc86d5'
sleep 10; echo "done"
echo 'ob_comint_async_shell_end_ca48d711-c1d3-4ec3-8e9b-072f76fc86d5'
ob_comint_async_shell_start_ca48d711-c1d3-4ec3-8e9b-072f76fc86d5
org_babel_sh_prompt> done
org_babel_sh_prompt>
ob_comint_async_shell_end_ca48d711-c1d3-4ec3-8e9b-072f76fc86d5
org_babel_sh_prompt>
#+end_example

Even I testing using content directly instead of in "EVAL" property like
bellowing:

#+begin_src org
Test src_sh{pwd} {{{results(=/Users/stardiviner/Org/Wiki/ACG/Anime/Anime
Videos=)}}}
#+end_src

It works fine.

But I failed to