fix error when pcntl extension is not loaded

This commit is contained in:
Beu 2023-12-23 21:10:31 +01:00
parent 996dde826d
commit f7b3fb5f71
2 changed files with 8 additions and 4 deletions

View File

@ -29,7 +29,9 @@ if (!ini_get('date.timezone') && function_exists('date_default_timezone_set')) {
gc_enable(); gc_enable();
// Listen process signals // Listen process signals
pcntl_async_signals(true); if (extension_loaded('pcntl')) {
pcntl_async_signals(true);
}
// Register AutoLoader // Register AutoLoader
require_once MANIACONTROL_PATH . 'core' . DIRECTORY_SEPARATOR . 'AutoLoader.php'; require_once MANIACONTROL_PATH . 'core' . DIRECTORY_SEPARATOR . 'AutoLoader.php';

View File

@ -653,9 +653,11 @@ class ManiaControl implements CallbackListener, CommandListener, TimerListener,
try { try {
// Manage SIGTERM signal // Manage SIGTERM signal
if (extension_loaded('pcntl')) {
pcntl_signal(SIGTERM, function() { pcntl_signal(SIGTERM, function() {
$this->quit("Stop signal received from the OS.", false); $this->quit("Stop signal received from the OS.", false);
}); });
}
// Connect to server // Connect to server
$this->connect(); $this->connect();