From: Aryn Starr <whereislelouch@icloud.com>
To: zsh-users@zsh.org
Subject: Weird behavior with redirecting stdin
Date: Mon, 2 Sep 2019 18:28:27 +0430 [thread overview]
Message-ID: <3A161CB3-442A-4E0B-9A0E-1C62A72DF6DB@icloud.com> (raw)
With these functions:
```
fcm () {
# Function for selecting a command interactively
echo ${(F)commands} | fzf
}
teec () {
# Dumbed down version of a function that both echoes and copies to clipboard. (Current toy version just echoes.)
local out="$(</dev/stdin)"
print -r -- "$out"
}
```
I can do `fcm | teec` and it works correctly.
However, if I change `teec` to this:
```
teec () {
echo 'echo hi' | { eval "$(</dev/stdin)" }
local out="$(</dev/stdin)"
print -r -- "$out"
}
```
Then running `fcm | teec` hangs (after printing `hi`) and doesn’t even get interrupted with ^D or ^C.
I don’t understand why these problems occur at all, and I have no idea how to go about fixing them ...
next reply other threads:[~2019-09-02 13:59 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-09-02 13:58 Aryn Starr [this message]
2019-09-02 14:00 ` Pier Paolo Grassi
2019-09-02 14:36 ` Roman Perepelitsa
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=3A161CB3-442A-4E0B-9A0E-1C62A72DF6DB@icloud.com \
--to=whereislelouch@icloud.com \
--cc=zsh-users@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).