* [PATCH] jobs: Report creation of background jobs
@ 2021-09-26 7:12 Ron Yorston
2024-04-05 8:49 ` Herbert Xu
0 siblings, 1 reply; 2+ messages in thread
From: Ron Yorston @ 2021-09-26 7:12 UTC (permalink / raw)
To: dash
Although it doesn't seem to be in POSIX it's relatively common
for interactive shells to report details of jobs run in the
background. bash, ksh and tcsh report job id and pid while
the Bourne shell from Unix V7 reports only the pid.
This from bash:
$ sleep 100 & sleep 200 &
[1] 4626
[2] 4627
$ sleep 300 | sleep 400 &
[3] 4636
$ jobs -l
[1] 4626 Running sleep 100 &
[2]- 4627 Running sleep 200 &
[3]+ 4635 Running sleep 300
4636 | sleep 400 &
Unlike reporting of job completions such messages are not controlled
by 'set -m'.
ash has never supported reporting of the creation of background
jobs. Add this feature to dash.
Signed-off-by: Ron Yorston <rmy@frippery.org>
---
src/jobs.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/src/jobs.c b/src/jobs.c
index f3b9ffc..4e0cdcc 100644
--- a/src/jobs.c
+++ b/src/jobs.c
@@ -932,6 +932,8 @@ static void forkparent(struct job *jp, union node *n, int mode, pid_t pid)
if (mode == FORK_BG) {
backgndpid = pid; /* set $! */
set_curjob(jp, CUR_RUNNING);
+ if (iflag && jp && jp->nprocs == 0)
+ outfmt(out2, "[%d] %d\n", jobno(jp), pid);
}
if (jp) {
struct procstat *ps = &jp->ps[jp->nprocs++];
--
2.31.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] jobs: Report creation of background jobs
2021-09-26 7:12 [PATCH] jobs: Report creation of background jobs Ron Yorston
@ 2024-04-05 8:49 ` Herbert Xu
0 siblings, 0 replies; 2+ messages in thread
From: Herbert Xu @ 2024-04-05 8:49 UTC (permalink / raw)
To: Ron Yorston; +Cc: dash
On Sun, Sep 26, 2021 at 08:12:10AM +0100, Ron Yorston wrote:
> Although it doesn't seem to be in POSIX it's relatively common
> for interactive shells to report details of jobs run in the
> background. bash, ksh and tcsh report job id and pid while
> the Bourne shell from Unix V7 reports only the pid.
>
> This from bash:
>
> $ sleep 100 & sleep 200 &
> [1] 4626
> [2] 4627
> $ sleep 300 | sleep 400 &
> [3] 4636
> $ jobs -l
> [1] 4626 Running sleep 100 &
> [2]- 4627 Running sleep 200 &
> [3]+ 4635 Running sleep 300
> 4636 | sleep 400 &
>
> Unlike reporting of job completions such messages are not controlled
> by 'set -m'.
>
> ash has never supported reporting of the creation of background
> jobs. Add this feature to dash.
>
> Signed-off-by: Ron Yorston <rmy@frippery.org>
> ---
> src/jobs.c | 2 ++
> 1 file changed, 2 insertions(+)
Thanks but as minimalism is one of the primary goals of dash
I won't be applying this.
--
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-04-05 8:48 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-26 7:12 [PATCH] jobs: Report creation of background jobs Ron Yorston
2024-04-05 8:49 ` Herbert Xu
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).