Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Anonymous functions don't show up well in "jobs" builtin output, except
- X-seq: zsh-workers 50837
- From: John Hawkinson <jhawk@xxxxxxxxxxxx>
- To: zsh-workers@xxxxxxx
- Subject: Anonymous functions don't show up well in "jobs" builtin output, except
- Date: Mon, 24 Oct 2022 17:49:53 -0400
- Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 18.7.68.33) smtp.rcpttodomain=alum.mit.edu smtp.mailfrom=alum.mit.edu; dmarc=pass (p=none sp=none pct=100) action=none header.from=alum.mit.edu; dkim=none (message not signed); arc=none
- Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=xerEKjE4Ll6TaBpL3EvZON+OgeAC4NyUROO1X7nhcr8=; b=fOhj70WaXNp5C7nm1pBJ6NUHoRZy3tL/4VaElVmhV7zdW7QsGfoO1OIY1QeMB47KUMNxVzlLMXI0WEZ4+0r2+FHaIXugZhPKScDL9N8RoKmJydwk+KGbsN7LPmF50QzfDCXZMKP+6prBlAl6tG3fiNPwXa0N3mLAhkDkYmFvfij6NoZ70+i3Br/uWOES9IGkOPoAgK+Lbh5HKMIbuL9iYxds6Mlaz1+b2r5rOK5nwl10H9+W8suzW/W/mbFMTU1jUlzz0Znr5x2dENnoRI3un7P0aPvSTvOHivqWzAMn5L5Nv1PLBJp5HIJpz6YdRC5sjmZhHi7PhaZ1MZQCmnR8qg==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Uz1XZogkCOZe5xJrdcz2B3jR5j4AGtswKbOJmzRqdGwTnWHLy1Euj6YMh0/HbKfSn2yr4+Of8HUu6Ic+qeBmXO/4543uIHklhKKUlf3hu82OroV9W07+pUv/H/3Q5yuU8YNbFKH6eYbOQMlbnaxwsI6+ySDhjQDhRtZ5DnMrO0az3q3hEb96Ql+5Jshkv97X0jZAW1Xo0K3u9yoE6V2llWWA9S5XwGYtc7olfFUa1Kh+zO3TSAkkiH4hp3X6LEIS5V4nN6hy7ObX0ii88p4I5wyaTgLsNCPexhsa/EL7p2114LHZ0Ynd2uIgeqlN+4fJwNmbmX6xQSwjEC4YAZP9XQ==
- Archived-at: <https://zsh.org/workers/50837>
- List-id: <zsh-workers.zsh.org>
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@xxxxxxxxxxxx
John Hawkinson
Messages sorted by:
Reverse Date,
Date,
Thread,
Author