zsh-users
 help / color / mirror / code / Atom feed
From: Atom Smasher <atom@smasher.org>
To: Peter Stephenson <pws@csr.com>
Cc: zsh-users@sunsite.dk
Subject: Re: killed by signal
Date: Tue, 7 Apr 2009 12:58:48 +1200 (NZST)	[thread overview]
Message-ID: <20090407005850.34922.qmail@smasher.org> (raw)
In-Reply-To: <20090406100300.5c377728@news01>

On Mon, 6 Apr 2009, Peter Stephenson wrote:

> $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).
===============

i can use the return status to figure out if a command was "terminated" by 
a signal, and which signal was the killer... 128+9 = 137 == KILL. i know 
the command immediately preceding the precmd was KILLed.

but if a command is suspended (TSTP; 20 on linux, 18 on freebsd) precmd 
will see a return status <128, which could be a "legal" value for a 
command to return indicating a particular failure. i'd like precmd to 
distinguish between a command that returns 18 or 20 (freebsd or linux, 
respectively), and a command that is suspended with ^Z.

specific example... on freebsd i can get a return status of 18 either by 
suspending a job with ^Z, or running:
 	zip -MM foo.zip no-such-file
  so the question is: how can the shell (can the shell?) tell that one of 
those was suspended with a signal (^Z, TSTP), and zip which is indicating 
a specific failure (zip: "File not found").

for a few seconds i thought the ERRNO might be useful, but it seems to not 
be.

thanks...


-- 
         ...atom

  ________________________
  http://atom.smasher.org/
  762A 3B98 A3C3 96C9 C6B7 582A B88D 52E4 D9F5 7808
  -------------------------------------------------

 	"Since trade ignores national boundaries and the manufacturer
 	 insists on having the world as a market, the flag of his
 	 nation must follow him, and the doors of the nations which
 	 are closed against him must be battered down. Concessions
 	 obtained by financiers must be safeguarded by ministers of
 	 state, even if the sovereignty of unwilling nations be
 	 outraged in the process. Colonies must be obtained or
 	 planted, in order that no useful corner of the world may be
 	 overlooked or left unused."
 		-- Woodrow Wilson,
 		President of the United States, 1919


  reply	other threads:[~2009-04-07  0:59 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-04-06  8:27 Atom Smasher
2009-04-06  9:03 ` Peter Stephenson
2009-04-07  0:58   ` Atom Smasher [this message]
2009-04-07 10:25     ` Atom Smasher

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20090407005850.34922.qmail@smasher.org \
    --to=atom@smasher.org \
    --cc=pws@csr.com \
    --cc=zsh-users@sunsite.dk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).