rc-list - mailing list for the rc(1) shell
 help / color / mirror / Atom feed
* builtin exit
@ 1991-12-29 10:53 Julian L. Ho
  1991-12-29 12:45 ` John Mackin
  0 siblings, 1 reply; 2+ messages in thread
From: Julian L. Ho @ 1991-12-29 10:53 UTC (permalink / raw)
  To: rc

It would be nice if exit took strings like 'sigint', etc... just a
single string (a list like return handles wouldn't be possible, I
know).

It would also be nice if signal handlers had some way of telling how
they were called (I'm thinking setting $status on entry to signal
handlers, or possibly $*, to some meaningful string).

For example, I'd like something like this to work:

    pipes=()

    fn sigexit sigint sigquit { s=$status {
	rm $pipes
	exit $s
    } }

    #code that builds $pipes (list of files) and does things with
    #it

The idea is to have the script exit with 'sigint', 'sigquit', the
argument to builtin exit (if its used), or the exit status of the last
command (if we just fall off the end in "code...")...

Currently, I'm doing something like:

    pipes=()

    fn sigint sighup sigquit {
	rm $pipes
	exit 1
    }

    #code...

    # Normal exit follows (a copy of the cleanup code in the handler)
    rm $pipes

But that only works because my code doesn't call builtin exit in the
middle...  also, exiting with the exit status of the cleanup code (rm
in this example) isn't necessarily correct.  If the user causes an
interrupt, the cleanup actions are taken but the exit status is 1, not
'sigint', or whatever...


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~1991-12-29 13:45 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1991-12-29 10:53 builtin exit Julian L. Ho
1991-12-29 12:45 ` John Mackin

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