Date: Tue, 18 Jan 2022 18:15:15 +0000 From: bugzilla-noreply@freebsd.org To: bugs@FreeBSD.org Subject: [Bug 261200] Unable to pipe the output of jobs in sh Message-ID: <bug-261200-227-VQ7iO56AlH@https.bugs.freebsd.org/bugzilla/> In-Reply-To: <bug-261200-227@https.bugs.freebsd.org/bugzilla/> References: <bug-261200-227@https.bugs.freebsd.org/bugzilla/>
next in thread | previous in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D261200 --- Comment #5 from Ron Wills <ron@digitalcombine.ca> --- While tracing a simple script like: sleep 1000& jobs jobs | cat I find that the first execution of jobs is executed by the shell process it= self and the second piped jobs is forked then executed in a child process. In bo= th cases the jobtab, found in jobs.c, has four entries in it but in the child process all the jobs are marked unused. In the function forkshell(), found in jobs.c, there's a section of code for= the new child process that clears the jobtab. for (i =3D njobs, p =3D jobtab ; -- i >=3D 0 ; p++) if (p->used) freejob(p); And this is the reason why jobs shows no entries when piped. I'm not sure why this is done. I'm assuming this is possibly to prevent the child process from doing some kind of job clean up later... I'll keep diggi= ng into this as time permits ;) --=20 You are receiving this mail because: You are the assignee for the bug.=
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-261200-227-VQ7iO56AlH>