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

Re: How to misplace an entire pipeline



On Sep 12,  9:03am, Bart Schaefer wrote:
}
} If I understand correctly, thisjob == -1 means there is no foreground
} job.  I'm scratching my head over how list_pipe can be true when there
} is no job in the foreground.

In particular I can't decide whether the fix is to do this:

494c494,496
< 		 (list_pipe && (jobtab[thisjob].stat & STAT_BUILTIN))) &&
---
> 		 (list_pipe &&
> 		  (thisjob == -1 ||
> 		   (jobtab[thisjob].stat & STAT_BUILTIN)))) &&

Or this:

494c494,496
< 		 (list_pipe && (jobtab[thisjob].stat & STAT_BUILTIN))) &&
---
> 		 (list_pipe &&
> 		  (thisjob != -1 &&
> 		   (jobtab[thisjob].stat & STAT_BUILTIN)))) &&


The first way treats no-foreground-job as if a shell builtin were in the
foreground.  The second way treats no-foreground-job as if an external
command were in the foreground.  I tend to think the former is the way
to go here -- if there's no job in the foreground, then the parent shell
must be in the foreground, and hence nothing is prepared to restart the
signalled job if it gets stopped.  However, I'm not that confident that
I know all the cases where thisjob == -1 may be true.

Any help here?  If not we're going with plan (A).



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