From: Gerrit Pape <pape@smarden.org>
Subject: Re: runit - access to run script's exit status for finish?
Date: Thu, 15 Sep 2005 09:33:29 +0000 [thread overview]
Message-ID: <20050915092844.4037.qmail@6530944879c9e2.315fe32.mid.smarden.org> (raw)
In-Reply-To: <dg45s2$erf$1@sea.gmane.org>
On Mon, Sep 12, 2005 at 10:11:58AM -0500, Charles Duffy wrote:
> Gerrit Pape wrote:
> >This sounds like a very good idea. I didn't re-check, but it should be
> >possible to extend the supervise/status file by two bytes, being the
> >last return code from ./run and ./finish, initially 0, without breaking
> >backward compatibility.
>
> From what I've seen from the code so far, I agree that there shouldn't
> be backwards-compatibility issues.
>
> However, on actually attempting to implement the interface we discussed,
> I've found it to be somewhat inadequate: It permits the user to retrieve
> the last exit status, but does *not* have any way to track there has
> been any exit at all within this run, nor whether the program terminated
> via a signal without calling exit() [and thus without setting an exit
> status].
>
> I'm considering extending by sizeof(int)*2 and storing wait()'s output
> verbatim; that way, WIFEXITED/WIFSIGNALED/WTERMSIG/WEXITSTATUS are all
> available, and it's possible to determine if the last exit was via a
> signal (and if so, what).
>
> This leaves open the question of how to expose this information to the
> user. I'm considering the following:
>
> -r: last exit type and value for ./run
> -f: last exit type and value for ./finish
>
> could return instead of <rc>, <type>:<rc>, as in "signal:11", "exit:0",
> "exit:1" or "none:0" (if there has, as of yet, been no exit).
>
> Thoughts?
It's a good idea to include this additional information into
supervise/status. What I'm not sure about is the output "<type>:<rc>".
How about simply having the exit code (0-255) printed if ./run
terminated cleanly, the signal number prefixed with '-' if it
terminated due to an uncatched signal, and nothing if ./run didn't
terminate at all yet?:
# sv status -r .
0
#
./run terminated with return code 0.
# sv status -r .
-13
#
./run terminated due to uncatched SIGPIPE.
# sv status -r .
#
./run didn't terminate yet, since the supervisor started.
Regards, Gerrit.
next prev parent reply other threads:[~2005-09-15 9:33 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-05-25 16:26 Charles Duffy
2005-05-29 5:52 ` Gerrit Pape
2005-05-30 7:42 ` Laurent Bercot
2005-05-31 11:49 ` Gerrit Pape
2005-05-31 14:28 ` Paul Jarc
2005-05-31 19:09 ` Gerrit Pape
2005-06-01 0:05 ` Joan Picanyol i Puig
2005-08-26 20:30 ` Charles Duffy
2005-08-27 19:24 ` Gerrit Pape
2005-08-27 22:56 ` Charles Duffy
2005-08-29 8:12 ` Gerrit Pape
2005-08-29 10:08 ` Charles Duffy
2005-08-30 11:06 ` Gerrit Pape
2005-08-30 16:55 ` Charles Duffy
2005-09-01 9:13 ` Gerrit Pape
2005-09-12 15:11 ` Charles Duffy
2005-09-15 9:33 ` Gerrit Pape [this message]
2005-09-15 12:18 ` Paul Jarc
2005-09-15 14:46 ` Gerrit Pape
2005-09-15 18:10 ` Charles Duffy
2005-09-16 8:15 ` Gerrit Pape
2005-08-27 23:01 ` Charles Duffy
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=20050915092844.4037.qmail@6530944879c9e2.315fe32.mid.smarden.org \
--to=pape@smarden.org \
/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.
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).