Re: Question: Should exit() print out the integer exit-status?
| From: | Lars Torben Wilson | Date: | Wed, 19 Dec 2001 11:52:39 +0000 |
| Subject: | Re: Question: Should exit() print out the integer exit-status? | ||
| References: | 1 2 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-74366@lists.php.net to get a copy of this message | ||
Vlad Krupin writes:
> Uh?
> You probably do not want to see the returned code printed anyway (unless
> you are debugging and are lazy to get it in any other way). Chances are
> that the codes returned by exit() won't make much sense to anyone but
> the one who develops the code, and it's not too difficult to do:
> echo 1;
> exit(1);
>
> There are ways to print out a message right before we exit. There aren't
> too many ways to return an error code. I can think of a very good reason
> why we might want the error code returned, but not prnted (in fact, a
> lot of reasons), and we don't have this functionality. Hence, at least
> if parameter to exit() is an int, we should just return the error code,
> *not* print it.
>
> I know, nobody has called a vote, but I thought I'd express my opinion
> in the form of a vote anyway, since somebody asked:)
>
> Vlad
+1
> Jani Taskinen wrote:
>
> >background information:
> >
> >http://bugs.php.net/bug.php?edit=1&id=11008
> >http://bugs.php.net/bug.php?edit=1&id=14574
> >
> >exit() function is broken. Fixing the broken behaviour is the
> >only real solution, IMO.
> >
> >One solution:
> >
> >- When passed argument is string: print out this string
> >- When passed argument is integer: Don't print it, use it as exit-status
> >
> >This is what is the expected behaviour is and I really can't think
> >of any good examples where this would fail. Nobody ever gave any.
> >And to get the REAL users (not only Zeev's opinion) I'm sending
> >this also to php-general.
> >
> >>From manual:
> >
> >"The exit() function terminates execution of the script. It prints
> >status just before exiting. If status is an integer, that value will be
> >used as exit-status."
> >
> >This can be understood in many ways. If the status is integer,
> >it is used as exit-status..but it's not clear that it's ALSO printed out
> >which is simply buggy behaviour.
> >
> >Now, if general concencus amongs the users of PHP is that it should
> >also print out the exit-status when it's an integer then 'shell_exit()'
> >function should be added.
> >
> >--Jani
> >
> >
> >
> >
>
>
>
>
> --
> PHP Development Mailing List <http://www.php.net/>
> To unsubscribe, e-mail: php-dev-unsubscribe@lists.php.net
> For additional commands, e-mail: php-dev-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net
>
--
Torben Wilson <torben@php.net>
http://www.thebuttlesschaps.com
http://www.hybrid17.com
http://www.inflatableeye.com
+1.604.709.0506