From: John Hawkinson <jhawk@alum.mit.edu>
To: zsh-workers@zsh.org
Subject: Anonymous functions don't show up well in "jobs" builtin output, except
Date: Mon, 24 Oct 2022 17:49:53 -0400 [thread overview]
Message-ID: <Y1cIgQUOJZPzSS+x@louder-room.local> (raw)
Hi.
I recently had a use-case where I needed to use an anonymous function shell one-liner to do some trickery with =() process substitution persisting for multiple commands (That is, () { thing1 $1; thing2 $1 } =(echo echo foo) ). I was surprised to find the resulting command was not meaningfully represented in the jobs builtin output.
I'm not 100% sure this rises to the level of "bug," but it is a bit annoying and would be nice to have corrected.
I saw this in zsh 5.8.1, but it reproduces in the git head (5b1c204c54e3ba41411e583ea649532b12977845):
jhawk@lrr ~ % zsh-dev --version
zsh 5.9.0.1-dev (arm-apple-darwin21.6.0)
jhawk@lrr ~ % zsh-dev -f
lrr% cat
^Z
zsh: suspended cat
lrr% ( cat; )
^Z
zsh: suspended ( cat; )
lrr% { cat; }
^Zzsh: suspended cat
lrr% () { cat; }
^Z
zsh: suspended
lrr% jobs
[1] suspended cat
[2] suspended ( cat; )
[3] - suspended cat
[5] + suspended
lrr% () { cat; } &
[6] 81263
lrr%
[6] + suspended (tty input) () { ... }
The suspension of the raw cat command ([1]), the subshell ([2]), and the list ([3]) all appear fine.
But the anonymous function does not. Not clear what happened to [4] but I guess it is [5].
It's notable that the same command-line when backgrounded explicitly with & appears to show up reasonably ([6]), even though when suspended manually with ^Z ([5]), it did not.
(There also seems to be something peculiar with respect to terminal settings getting screwed up in this process, where "reset" or "tput reset" or even cat<RET><ESC>[c<RET><CTRL-d> to get back to normal. Not sure what's up with that, and I think that's not in scope for this bug report.)
I have not attempted to craft a patch (or even inspect the code), but if it's helpful for your workflow I'm happy to do that. I am new to zsh development. (And honestly...almost new to zsh; back to it after a 28-year hiatus! Triggered by Apple, of course.)
Thanks.
--
jhawk@alum.mit.edu
John Hawkinson
next reply other threads:[~2022-10-24 21:50 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-24 21:49 John Hawkinson [this message]
2022-10-25 8:23 ` Peter Stephenson
[not found] ` <Y1ewKOKQJ1AnvR92@louder-room.local>
2022-10-25 10:05 ` Peter Stephenson
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=Y1cIgQUOJZPzSS+x@louder-room.local \
--to=jhawk@alum.mit.edu \
--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).