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

Re: jobs -r doesn't show jobs continued by kill -CONT



On May 4,  6:36pm, Peter Stephenson wrote:
} Subject: Re: jobs -r doesn't show jobs continued by kill -CONT
}
} On Mon, 4 May 2015 06:52:13 +0800
} Han Pingtian <hanpt@xxxxxxxxxxxxxxxxxx> wrote:
} > jobs -r doesn't show a job which suspended the continued by kill -CONT:
} 
} Not sure whether to use makerunning() here.  It's handled per process
} rather than per job at this point, so it's not entirely clear at what
} point the STAT_STOPPED flag should be removed, either.

Is there compound-command weirdness that's going to show up as a result
of changing jn->stat along with pn->status if there is more than one
process per job?

torch% sleep 50 | sleep 51 | sleep 52

zsh: suspended  sleep 50 | sleep 51 | sleep 52
torch% ps ax | grep sleep
18552 pts/3    T      0:00 sleep 50
18553 pts/3    T      0:00 sleep 51
18554 pts/3    T      0:00 sleep 52
18556 pts/3    S+     0:00 grep sleep
torch% kill -CONT 18553
torch% jobs
[1]  + suspended  sleep 50 | 
       running    sleep 51 | 
       suspended  sleep 52
torch% jobs -s
torch% jobs -r
[1]  + suspended  sleep 50 | 
       running    sleep 51 | 
       suspended  sleep 52
torch% 

Is it really correct to treat that last one as "running" when two-thirds
of it is still stopped?

There's something else a bit odd here, but I don't know that it's fixable.

torch% sleeper() { echo sleeping; sleep 50; echo done sleeping }
torch% sleeper
torch% sleeper                                                  
sleeping
zsh: suspended  sleeper
torch% jobs -l
[1]  + 18524 suspended  sleeper
torch% kill -CONT 18524
done sleeping                                                                   
torch% ps x | grep sleep
18523 pts/3    T      0:00 sleep 50

So the function resumed but its child remained stopped.  On the other
hand if I CONT the child sleep itself, the function remains "suspended"
as far as the parent "jobs" can tell, but it wakes up and exits when it
gets the CHLD from the actual sleep timing out.

torch% sleeper
sleeping
zsh: suspended  sleeper
torch% jobs -l
[1]  + 18543 suspended  sleeper
torch% kill -CONT 18542
torch% ps ax | grep '1854[23]'
18542 pts/3    S      0:00 sleep 50
18543 pts/3    T      0:00 Src/zsh -f
torch% done sleeping

[1]  + done       sleeper
torch% 


-- 
Barton E. Schaefer



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