zsh-workers
 help / color / mirror / code / Atom feed
From: Tycho Kirchner <tychokirchner@mail.de>
To: zsh-workers@zsh.org
Subject: Unexpected stdin-behavior
Date: Thu, 21 Oct 2021 14:40:14 +0200	[thread overview]
Message-ID: <2abd99f9-c1c0-1385-f8b4-be9b8f14c4d9@mail.de> (raw)

Dear zsh-maintainers,

first of all, I'm not a mail-subscriber but please respond to this email 
anyway ^_^

I almost finished the (yet unpublished) zsh-integration of my 
shell-tracker shournal[1] and noticed some inconsistency on the handling 
of stdin during an integration test.
While bash -i and zsh -s show the expected behavior (stdin is "consumed" 
command by command) zsh -s -i seems to "consume" the whole stdin 
beforehand (see below). I there a rationale behind this?
What I actually try to do is running automated tests on an interactive 
zsh with prompts, preexec, etc by piping commands to it similar to the 
snippet below.

Thanks in advance
Tycho Kirchner

[1] https://github.com/tycho-kirchner/shournal

____________________________________________________________

debian-dell% echo $ZSH_VERSION
5.8
debian-dell% stdintest(){ printf 'echo one\nsh -c "while read -r row; do 
echo got row \$row; done" \necho two\n'; }
debian-dell% stdintest | bash  --norc --noprofile -i
bash-5.0$ echo one
one
bash-5.0$ sh -c "while read -r row; do echo got row \$row; done"
got row echo two
bash-5.0$ exit
debian-dell% stdintest | zsh -f -s
one
got row echo two
debian-dell% stdintest | zsh -f -s -i
debian-dell% one
debian-dell% %
debian-dell% two
debian-dell% %
debian-dell%






             reply	other threads:[~2021-10-21 12:40 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-21 12:40 Tycho Kirchner [this message]
2021-10-21 15:55 ` Bart Schaefer
     [not found]   ` <13d30855-d91c-7def-6834-f0ec24cfd598@mail.de>
2021-10-21 19:14     ` Bart Schaefer
2021-10-22 10:28       ` Tycho Kirchner
2021-10-22 10:58       ` Peter Stephenson
2021-10-22 14:24       ` Tycho Kirchner

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=2abd99f9-c1c0-1385-f8b4-be9b8f14c4d9@mail.de \
    --to=tychokirchner@mail.de \
    --cc=zsh-workers@zsh.org \
    /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 public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).