about summary refs log tree commit diff
path: root/Doc/Zsh/builtins.yo
diff options
context:
space:
mode:
authorPeter Stephenson <p.stephenson@samsung.com>2022-03-30 09:28:43 +0100
committerPeter Stephenson <p.stephenson@samsung.com>2022-03-30 09:28:43 +0100
commit98e46340867028808e71e7f3373881cb7e5b6764 (patch)
treece804301a1890959e620dabf3e87da5a63503f80 /Doc/Zsh/builtins.yo
parentf11227f78d8d477048194df5b93dfe315d4b1588 (diff)
downloadzsh-98e46340867028808e71e7f3373881cb7e5b6764.tar.gz
zsh-98e46340867028808e71e7f3373881cb7e5b6764.tar.xz
zsh-98e46340867028808e71e7f3373881cb7e5b6764.zip
49906 (Bart), 49911: Fixes to querying jobs in subshell.
Don't attempt to query invalid job off end of table, resulting in
crashes from $jobtstates.

If background task started in subshell, look at tatsks within subshell
instead of main shell.  Document and add test.
Diffstat (limited to 'Doc/Zsh/builtins.yo')
-rw-r--r--Doc/Zsh/builtins.yo18
1 files changed, 18 insertions, 0 deletions
diff --git a/Doc/Zsh/builtins.yo b/Doc/Zsh/builtins.yo
index 5649e00d4..1d74f0c17 100644
--- a/Doc/Zsh/builtins.yo
+++ b/Doc/Zsh/builtins.yo
@@ -1114,6 +1114,24 @@ The tt(-Z) option replaces the shell's argument and environment space with
 the given string, truncated if necessary to fit.  This will normally be
 visible in tt(ps) (manref(ps)(1)) listings.  This feature is typically
 used by daemons, to indicate their state.
+
+Full job control is only available in the top-level interactive shell,
+not in commands run in the left hand side of pipelines or within
+the tt(LPAR())var(...)tt(RPAR()) construct.  However, a snapshot
+of the job state at that point is taken, so it is still possible
+to use the tt(jobs) builtin, or any parameter providing job information.
+This gives information about the state of jobs at the point the subshell
+was created.  If background processes are created within the subshell,
+then instead information about those processes is provided.
+
+For example,
+
+example(sleep 10 &    # Job in background
+LPAR()             # Shell forks
+jobs          # Shows information about "sleep 10 &"
+sleep 5 &     # Process in background (no job control)
+jobs          # Shows information about "sleep 5 &"
+RPAR())
 )
 findex(kill)
 cindex(killing jobs)