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

Reply via email to