mirror of
https://github.com/zhamao-robot/zhamao-framework.git
synced 2026-03-17 20:54:52 +08:00
add windows exit code support
This commit is contained in:
parent
6f30c04899
commit
05ac2feebd
@ -37,10 +37,7 @@ ob_event_provider()->addEventListener(WorkerStartEvent::getName(), function () {
|
||||
} finally {
|
||||
global $_swoole_atomic;
|
||||
$_swoole_atomic->set($retcode ?? 0);
|
||||
if (DIRECTORY_SEPARATOR === '\\') {
|
||||
exit($retcode ?? 0);
|
||||
}
|
||||
Framework::getInstance()->stop();
|
||||
Framework::getInstance()->stop($retcode ?? 0);
|
||||
}
|
||||
}, 1);
|
||||
|
||||
|
||||
@ -109,7 +109,7 @@ class Framework
|
||||
* 未测试
|
||||
* @throws ZMKnownException
|
||||
*/
|
||||
public function stop()
|
||||
public function stop(int $retcode = 0)
|
||||
{
|
||||
switch ($this->driver->getName()) {
|
||||
case 'swoole':
|
||||
@ -120,7 +120,7 @@ class Framework
|
||||
if (extension_loaded('posix')) {
|
||||
posix_kill(ProcessStateManager::getProcessState(ZM_PROCESS_MASTER)['pid'], SIGTERM);
|
||||
} else {
|
||||
Worker::stopAll();
|
||||
Worker::stopAll($retcode);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user