Re: exit status
- From: "Jerry Adair" <jerry.adair@xxxxxxx>
- Date: Fri, 31 Mar 2006 12:03:55 -0500
Paul-
Not sure why I am getting the flack from you, but whatever. The question
seemed simple enough to me, I never said that exit() was broken. Sheesh.
Anyway, I have read the documentation and know about the return value from
wait, etc. To answer the other questions I have been asked, I am using
system() calls to invoke the script.
inside script "1":
my $exitStatus = system( "<call to script #2>" );
print( STDOUT "exit=$exitStatus\n" );
inside script "2": (similar code)
my $return = system( "<call to a program>" );
print( STDOUT "return=$return\n" );
exit( $return >> 8 );
And the output from script "2" gives the number 2, whereas the output from
script "1" gives the number 0. From doing more reading in the Camel (yes, I
have already read all of the function descriptions that the other poster
suggested, I did try to solve this one on my own before coming here, believe
it or not) exit() doesn't actually exit straight away, but it calls some END
routines (I don't have any of those defined) which might change $? - perhaps
that is part of the problem.
Curiously, I changed the system() call in script "2" to an exec() call, and
I get the correct return value in script "1", namely the number 2.
I hope this helps. Any more flack and I think I'll punt and seek help
elsewhere.
Thanks,
Jerry
"Paul Lalli" <mritty@xxxxxxxxx> wrote in message
news:1143823805.677400.254100@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Jerry Adair wrote:
Ok I'll keep with my vane of asking potentially obvious questions.
Your problem is not with the obviousness of the question, but of the
complete lack of necessary information provided.
I am attempting to return an error code from a Perl script. At first
blush,
it seemed easy with the exit() call. But it doesn't work.
Yes it does. Come on. Do you really think that exit() is somehow
broken in the language, and you're just the first person to ever
notice?
Perhaps you could tell us exactly *how* you're determining that it
"doesn't work"?
Have you read the posting guidelines for this group yet? They contain
excellent advice and information on how to get the most help possible
from this group.
Paul Lalli
.
- Follow-Ups:
- Re: exit status
- From: xhoster
- Re: exit status
- From: Paul Lalli
- Re: exit status
- From: Dr.Ruud
- Re: exit status
- From: Paul Lalli
- Re: exit status
- References:
- exit status
- From: Jerry Adair
- Re: exit status
- From: Paul Lalli
- exit status
- Prev by Date: Re: CGI and CSS question
- Next by Date: Re: A Problem With GD
- Previous by thread: Re: exit status
- Next by thread: Re: exit status
- Index(es):
Relevant Pages
|