aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEvgeny Zinoviev <me@ch1p.io>2023-04-13 15:21:18 +0300
committerEvgeny Zinoviev <me@ch1p.io>2023-04-13 15:21:18 +0300
commitb3db543c43410fb5199000aed1ab61ba95d85536 (patch)
treea5b5ffec7b671bab9356180ca1508e95bb75b595
parenta788befa6b4a149cc168af9c2c8034fc22090cf9 (diff)
use pcntl only in cli modeHEADmaster
-rw-r--r--src/classes/Job.php8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/classes/Job.php b/src/classes/Job.php
index 56052cb..21ed1f0 100644
--- a/src/classes/Job.php
+++ b/src/classes/Job.php
@@ -51,9 +51,11 @@ abstract class Job extends model {
public function __construct(array $raw) {
parent::__construct($raw);
- pcntl_async_signals(true);
- pcntl_signal(SIGTERM, [$this, 'signalHandler']);
- pcntl_signal(SIGINT, [$this, 'signalHandler']);
+ if (PHP_SAPI === 'cli') {
+ pcntl_async_signals(true);
+ pcntl_signal(SIGTERM, [$this, 'signalHandler']);
+ pcntl_signal(SIGINT, [$this, 'signalHandler']);
+ }
}
protected function signalHandler(int $signal) {}