Re: Inconsistent exit code from CLI?
| From: | Richard Quadling | Date: | Tue, 26 Oct 2010 10:59:59 +0000 |
| Subject: | Re: Inconsistent exit code from CLI? | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-49972@lists.php.net to get a copy of this message | ||
On 26 October 2010 09:29, John Carter <johncart@cisco.com> wrote:
> Hi,
>
> When php is invoked from the command line with -h we get exit code 0 as
> expected:
>
> -bash-3.2# php -h ; echo $?
> Usage: php [options] [-f] <file> [--] [args...]
> php [options] -r <code> [--] [args...]
> php [options] [-B <begin_code>] -R <code> [-E <end_code>] [--]
> [args...]
> ...
> --re <name> Show information about extension <name>.
> --ri <name> Show configuration for extension <name>.
>
> 0
>
> However if we use (what I understand to be an) invalid option we also
> get 0:
>
> php -Z ; echo $?
> Usage: php [options] [-f] <file> [--] [args...]
> ....
> 0
>
> I've checked a couple of other tools (ls and grep) and they return exit
> code 2 when the options aren't recognised.
>
> Found on 5.2.14 and 5.3.3.
>
> Thanks,
>
> John.
Using windows ...
@ECHO OFF
ECHO Calling PHP -v
PHP -v
ECHO %ERRORLEVEL%
ECHO Calling PHP -j
PHP -j
ECHO %ERRORLEVEL%
Both errorlevels are 0.
--
Richard Quadling
Twitter : EE : Zend
@RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY