From: Matt <matt@excalamus.com>
To: "Ihor Radchenko" <yantar92@posteo.net>
Cc: "Org-mode" <emacs-orgmode@gnu.org>
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 [thread overview]
Message-ID: <187de29d882.c92c2b661216812.7786590004610447376@excalamus.com> (raw)
In-Reply-To: <877cts8emr.fsf@localhost>
---- 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
next prev parent reply other threads:[~2023-05-02 20:32 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-30 4:27 [Need Help] Error to evaluate "mpv" command in inline src block stardiviner
2023-04-30 4:46 ` Ruijie Yu via General discussions about Org-mode.
2023-04-30 10:59 ` Christopher M. Miles
2023-04-30 14:52 ` Ihor Radchenko
2023-05-01 3:39 ` Christopher M. Miles
2023-05-01 7:45 ` Ihor Radchenko
2023-05-01 10:46 ` Christopher M. Miles
2023-05-01 11:39 ` 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-01 12:50 ` ob-shell sessions will send final echo '...' as input key sequence when previous command reads input interactively Christopher M. Miles
2023-05-01 13:14 ` Ihor Radchenko
2023-05-01 13:41 ` Christopher M. Miles
2023-05-01 14:20 ` Ihor Radchenko
2023-05-01 19:06 ` Christopher M. Miles
2023-05-01 13:08 ` [SOLUTION] a temporary workaround solution using another language like "python" Christopher M. Miles
[not found] ` <35881.2693202466$1682946783@news.gmane.org>
2023-05-01 13:35 ` Max Nikulin
2023-05-01 19:01 ` Christopher M. Miles
2023-05-01 19:16 ` Ihor Radchenko
2023-05-02 4:17 ` [CLOSED] [ANSWER] " Christopher M. Miles
2023-05-02 20:31 ` Matt [this message]
2023-05-03 10:41 ` 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 11:01 ` ob-shell sessions will send final echo '...' as input key sequence when previous command reads input interactively Christopher M. Miles
2023-05-03 12:01 ` Ihor Radchenko
2023-05-03 16:31 ` Christopher M. Miles
2023-05-01 10:50 ` [Need Help] Error to evaluate "mpv" command in inline src block Christopher M. Miles
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=187de29d882.c92c2b661216812.7786590004610447376@excalamus.com \
--to=matt@excalamus.com \
--cc=emacs-orgmode@gnu.org \
--cc=yantar92@posteo.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.