Proper exit code
This commit is contained in:
parent
662c947953
commit
d7c7445207
2
docs
2
docs
|
@ -1 +1 @@
|
||||||
Subproject commit 42b994bbe543269072dcefa4421bdb4b828d8235
|
Subproject commit 9a873608310b43395032755c35bbdf17d35e23d7
|
|
@ -93,6 +93,6 @@ class Exception extends \Exception
|
||||||
public static function ExceptionHandler($exception)
|
public static function ExceptionHandler($exception)
|
||||||
{
|
{
|
||||||
Logger::log($exception, Logger::FATAL_ERROR);
|
Logger::log($exception, Logger::FATAL_ERROR);
|
||||||
Magic::shutdown();
|
Magic::shutdown(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -161,11 +161,11 @@ class Magic
|
||||||
//if (function_exists('pcntl_async_signals')) pcntl_async_signals(true);
|
//if (function_exists('pcntl_async_signals')) pcntl_async_signals(true);
|
||||||
Loop::unreference(Loop::onSignal(SIGINT, static function () {
|
Loop::unreference(Loop::onSignal(SIGINT, static function () {
|
||||||
Logger::log('Got sigint', Logger::FATAL_ERROR);
|
Logger::log('Got sigint', Logger::FATAL_ERROR);
|
||||||
Magic::shutdown();
|
Magic::shutdown(1);
|
||||||
}));
|
}));
|
||||||
Loop::unreference(Loop::onSignal(SIGTERM, static function () {
|
Loop::unreference(Loop::onSignal(SIGTERM, static function () {
|
||||||
Logger::log('Got sigterm', Logger::FATAL_ERROR);
|
Logger::log('Got sigterm', Logger::FATAL_ERROR);
|
||||||
Magic::shutdown();
|
Magic::shutdown(1);
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
if (!self::$altervista && !self::$zerowebhost) {
|
if (!self::$altervista && !self::$zerowebhost) {
|
||||||
|
@ -225,13 +225,15 @@ class Magic
|
||||||
/**
|
/**
|
||||||
* Shutdown system.
|
* Shutdown system.
|
||||||
*
|
*
|
||||||
|
* @param int $code Exit code
|
||||||
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public static function shutdown()
|
public static function shutdown(int $code = 0)
|
||||||
{
|
{
|
||||||
self::$signaled = true;
|
self::$signaled = true;
|
||||||
getStdin()->unreference();
|
getStdin()->unreference();
|
||||||
getInputBufferStream()->unreference();
|
getInputBufferStream()->unreference();
|
||||||
die();
|
die($code);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user