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

Re: killed by signal

On Mon, 6 Apr 2009 20:27:42 +1200 (NZST)
Atom Smasher <atom@xxxxxxxxxxx> wrote:
> if i understand it correctly... if zsh (or most/all other shells) spawns a 
> process that is "terminated" by a signal, the exit status returned (to?) 
> by the shell is 128+SIGNAL. but what about processes that are 
> stopped/suspended by signals (most likely ^Z, on the command line)? if a 
> process is stopped/suspended by a ^Z, is there *any* way for the parent 
> shell to figure out if the process was suspended? or to differentiate if 
> the return status just happens to be the same as a TSTP signal number?

$jobstates (from zsh/parameter) tells you.  If that's not the answer you'll
have to give more details about what you're actually trying to do (which is
often the way to get the most useful results).

% sleep 10 &
[1] 2117
% kill -TSTP %1
[1]  + suspended  sleep 10
% print $jobstates

Peter Stephenson <pws@xxxxxxx>                  Software Engineer
CSR PLC, Churchill House, Cambridge Business Park, Cowley Road
Cambridge, CB4 0WZ, UK                          Tel: +44 (0)1223 692070

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