Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: `jobs | wc -l' => 0 ... bug?



> On Mar 26,  3:29pm, Peter Stephenson wrote:
> } Subject: Re: `jobs | wc -l' => 0 ... bug?
> }
> } > $ jobs | wc -l
> } >       0
> } 
> } jobs here runs in a subshell, where there is no job control, so no
> } information on jobs.  It has always been this way.  It's not particularly
> } convenient, however.  Maybe it's time someone thought about changing it.
> 
> What do you suggest, that we special-case the "jobs" command?

Clearing the job table is handled specially in entersubsh().

    if (cl)
	clearjobtab();

MONITOR gets unset at this point, too.  It shouldn't be necessary to do
both, and it should be possible to hack bin_fg() so that it can still list
jobs even if it can't control them.  In fact, it looks like this is half
there: `fg' and `bg' test for !jobbing and complain, whereas `jobs'
doesn't and silently scans the empty job list.  So maybe not clearing the
job table and relying on the option setting just works.  But it needs a
proper work through to make sure.

-- 
Peter Stephenson <pws@xxxxxxx>                  Software Engineer
CSR Ltd., Unit 300, Science Park, Milton Road,
Cambridge, CB4 0XL, UK                          Tel: +44 (0)1223 392070



Messages sorted by: Reverse Date, Date, Thread, Author