diff options
author | Tanaka Akira <akr@users.sourceforge.net> | 1999-05-12 04:49:46 +0000 |
---|---|---|
committer | Tanaka Akira <akr@users.sourceforge.net> | 1999-05-12 04:49:46 +0000 |
commit | ea0ddb0fc6073be3d7d289e59b083f564dbd761f (patch) | |
tree | d1e3f1be8624d47e7e8a75838f9e84885a17a484 /Src/jobs.c | |
parent | 53d36e795b26a945048e7a87a1a91224f8e1663a (diff) | |
download | zsh-ea0ddb0fc6073be3d7d289e59b083f564dbd761f.tar.gz zsh-ea0ddb0fc6073be3d7d289e59b083f564dbd761f.tar.xz zsh-ea0ddb0fc6073be3d7d289e59b083f564dbd761f.zip |
pws-18 dot-zsh-199905171944
Diffstat (limited to 'Src/jobs.c')
-rw-r--r-- | Src/jobs.c | 34 |
1 files changed, 27 insertions, 7 deletions
diff --git a/Src/jobs.c b/Src/jobs.c index e94dd77e2..6ddef0f70 100644 --- a/Src/jobs.c +++ b/Src/jobs.c @@ -180,11 +180,14 @@ update_job(Job jn) } else { /* job is done, so remember return value */ lastval2 = val; /* If last process was run in the current shell, keep old status - * and let it handle its own traps + * and let it handle its own traps, but always allow the test + * for the pgrp. */ - if (job == thisjob && !(jn->stat & STAT_CURSH)) { - lastval = val; - inforeground = 1; + if (jn->stat & STAT_CURSH) + inforeground = 1; + else if (job == thisjob) { + lastval = val; + inforeground = 2; } } @@ -198,8 +201,20 @@ update_job(Job jn) /* is this job in the foreground of an interactive shell? */ if (mypgrp != pgrp && inforeground && (jn->gleader == pgrp || (pgrp > 1 && kill(-pgrp, 0) == -1))) { - attachtty(mypgrp); - adjustwinsize(); /* check window size and adjust if necessary */ + if (list_pipe) { + /* + * Oh, dear, we're right in the middle of some confusion + * of shell jobs on the righthand side of a pipeline, so + * it's death to call attachtty() just yet. Mark the + * fact in the job, so that the attachtty() will be called + * when the job is finally deleted. + */ + jn->stat |= STAT_ATTACH; + } else { + attachtty(mypgrp); + /* check window size and adjust if necessary */ + adjustwinsize(0); + } } } @@ -223,7 +238,7 @@ update_job(Job jn) * process group from the shell, so the shell will not receive * * terminal signals, therefore we we pretend that the shell got * * the signal too. */ - if (inforeground && isset(MONITOR) && WIFSIGNALED(status)) { + if (inforeground == 2 && isset(MONITOR) && WIFSIGNALED(status)) { int sig = WTERMSIG(status); if (sig == SIGINT || sig == SIGQUIT) { @@ -609,6 +624,11 @@ deletejob(Job jn) { struct process *pn, *nx; + if (jn->stat & STAT_ATTACH) { + attachtty(mypgrp); + adjustwinsize(0); + } + pn = jn->procs; jn->procs = NULL; for (; pn; pn = nx) { |