[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Getting the exit code in a SystemExit rescue block?

Lloyd Zusman

9/27/2004 10:32:00 PM

Assume that I have the following code:

begin
exit(42)
rescue SystemExit => e
# How do I find out the argument passed to exit() here?
end

Inside of the `rescue' block, is there any way for me to find out the
argument that was passed to exit()? In this example, I'd want to know
that `42' was passed.

Thanks in advance.

--
Lloyd Zusman
ljz@asfast.com
God bless you.



1 Answer

Yukihiro Matsumoto

9/27/2004 11:54:00 PM

0

In message "Re: Getting the exit code in a SystemExit rescue block?"
on Tue, 28 Sep 2004 07:31:30 +0900, Lloyd Zusman <ljz@asfast.com> writes:

| begin
| exit(42)
| rescue SystemExit => e
| # How do I find out the argument passed to exit() here?
p e.status
| end

matz.