aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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) {}