php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #4587 Would like exit and die to return an int
Submitted: 2000-05-24 21:10 UTC Modified: 2002-01-06 08:30 UTC
From: jeff_schnitter at peoplesoft dot com Assigned:
Status: Closed Package: Feature/Change Request
PHP Version: 4.04 OS: all
Private report: No CVE-ID: None
 [2000-05-24 21:10 UTC] jeff_schnitter at peoplesoft dot com
I think PHP is awesome.  I am a build engineer and am going to replace all of my shell scripts and perl scripts with PHP.  One thing that is currently hurting me is that exit and die do not return a value.

If I have a makefile with a target, and I run a PHP script to build that target, I want the PHP script to return a value.  That way, make will behave properly.

all: target1 target2

target1:
   php -q -f script1.php

target2:
   php -q -f script2.php

If script1.php does not execute successfully, I do not want script2.php to run.

This problem isn't limited to make.  If I have stand alone scripts that are called from other external programs, it is extremely important to be able to pass back a return code.

If it causes too much of a problem to change the signature of the exit and die functions, I'd be perfectly happy if there was a new function that did exit with a return code,
ie 

int exit_rc(int value)

Thanks for your consideration and thanks for a great language!

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-03-02 12:47 UTC] jeff_schnitter at peoplesoft dot com
Any update on this request?  Is there an existing way in the language that I can force a non-zero return code to be passed back to the OS?
 [2002-01-06 08:30 UTC] jan@php.net
fixed in CVS. closing.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 18 20:01:30 2024 UTC