[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: |
Matt |
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: |
Tue, 02 May 2023 16:31:37 -0400 |
User-agent: |
Zoho Mail |
---- 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
- Re: ob-shell sessions will send final echo '...' as input key sequence when previous command reads input interactively, (continued)
- Re: ob-shell sessions will send final echo '...' as input key sequence when previous command reads input interactively, Christopher M. Miles, 2023/05/01
- Re: ob-shell sessions will send final echo '...' as input key sequence when previous command reads input interactively, Ihor Radchenko, 2023/05/01
- Re: ob-shell sessions will send final echo '...' as input key sequence when previous command reads input interactively, Christopher M. Miles, 2023/05/01
- Re: ob-shell sessions will send final echo '...' as input key sequence when previous command reads input interactively, Ihor Radchenko, 2023/05/01
- Re: ob-shell sessions will send final echo '...' as input key sequence when previous command reads input interactively, Christopher M. Miles, 2023/05/01
- [SOLUTION] a temporary workaround solution using another language like "python", Christopher M. Miles, 2023/05/01
- Message not available
- Re: [SOLUTION] a temporary workaround solution using another language like "python", Max Nikulin, 2023/05/01
- Re: [SOLUTION] a temporary workaround solution using another language like "python", Christopher M. Miles, 2023/05/01
- Re: [SOLUTION] a temporary workaround solution using another language like "python", Ihor Radchenko, 2023/05/01
- [CLOSED] [ANSWER] Re: a temporary workaround solution using another language like "python", Christopher M. Miles, 2023/05/02
- 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),
Matt <=
- 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), Ihor Radchenko, 2023/05/03
- Re: ob-shell sessions will send final echo '...' as input key sequence when previous command reads input interactively, Christopher M. Miles, 2023/05/03
- Re: ob-shell sessions will send final echo '...' as input key sequence when previous command reads input interactively, Ihor Radchenko, 2023/05/03
- Re: ob-shell sessions will send final echo '...' as input key sequence when previous command reads input interactively, Christopher M. Miles, 2023/05/03
Re: [Need Help] Error to evaluate "mpv" command in inline src block, Christopher M. Miles, 2023/05/01