Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
[Bug] $jobstates does not work in $()
- X-seq: zsh-workers 49782
- From: Carl Agrell <caagr98@xxxxxxxxx>
- To: zsh-workers <zsh-workers@xxxxxxx>
- Subject: [Bug] $jobstates does not work in $()
- Date: Tue, 1 Mar 2022 01:46:05 +0100
- Archived-at: <https://zsh.org/workers/49782>
- List-id: <zsh-workers.zsh.org>
It appears that zsh/parameter's $jobstates is always empty inside $(),
probably because it's a subshell of some sort. `jobs` still works
however, making it rather incongruous. Having access to $jobstates
would be useful for prompts for example, rather than having to parse
the output of `jobs`.
To reproduce:
❯ sleep 1000 &
[1] 210460
❯ jobs
[1] + running sleep 1000
❯ echo $jobstates
running:+:210460=running
❯ echo $(jobs)
[1] + running sleep 1000
❯ echo $(echo $jobstates)
(empty)
Messages sorted by:
Reverse Date,
Date,
Thread,
Author