Skip to content

Commit

Permalink
fix signal handling for windows
Browse files Browse the repository at this point in the history
  • Loading branch information
medilies committed Aug 7, 2024
1 parent 072f94c commit b12497a
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/Dompurify/DompurifyService.php
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ public function throwIfFailedOnTerm(): void
throw new XsslessException('The service is still running');
}

if ($this->serviceProcess->getTermSignal() === SIGTERM) {
if ($this->isTermSignal(SIGTERM) || ($this->isTermSignal(0) && $this->isWindows())) {
return;
}

Expand All @@ -130,4 +130,14 @@ public function waitForTermination(int $timeout): void
}

// ========================================================================

private function isWindows(): bool
{
return strtoupper(substr(PHP_OS, 0, 3)) === 'WIN';
}

private function isTermSignal(int $signal): bool
{
return $this->serviceProcess->getTermSignal() === $signal;
}
}

0 comments on commit b12497a

Please sign in to comment.