在Ubuntu机器上:
$PHP -v PHP 5.5.10-1~dotdeb.1 (cli) (built: Mar 6 2014 18:55:59) Copyright (c) 1997-2014 The PHP Group Zend Engine v2.5.0,Copyright (c) 1998-2014 Zend Technologies with uopz v2.0.4,Copyright (c) 2014,by Joe Watkins <krakjoe@PHP.net> with Zend OPcache v7.0.3,Copyright (c) 1999-2014,by Zend Technologies with Xdebug v2.2.3,Copyright (c) 2002-2013,by Derick Rethans
<?PHP exit(1);
我希望这个命令PHP test.PHP || echo“error”显示“error”但它以状态码0退出.
$PHP test.PHP $echo $? 0
$PHP -r "exit(1);" || echo "error" error
要么
$PHP -r "exit(1);" $echo $? 1
在PHP的不同机器(archlinux)上:
PHP 5.5.13 (cli) (built: May 29 2014 05:46:58) Copyright (c) 1997-2014 The PHP Group Zend Engine v2.5.0,Copyright (c) 1998-2014 Zend Technologies
这是一个真正的问题,因为git hooks依赖于这个状态代码和Jenkins而我无法谷歌.
它可能以某种方式与配置相关吗?我检查了cli PHP.ini并且找不到任何可疑的东西.