mirror of
https://code.mensbeam.com/MensBeam/Arsse.git
synced 2024-12-22 21:22:40 +00:00
Tweaks
This commit is contained in:
parent
23749b51aa
commit
b9fd9ac32e
1 changed files with 6 additions and 2 deletions
|
@ -76,8 +76,8 @@ class Daemon {
|
||||||
|
|
||||||
protected function checkPID(string $pidfile) {
|
protected function checkPID(string $pidfile) {
|
||||||
if (file_exists($pidfile)) {
|
if (file_exists($pidfile)) {
|
||||||
$pid = @file_get_contents($pidfile);
|
$pid = (string) @file_get_contents($pidfile);
|
||||||
if (preg_match("/^\d+$/s", (string) $pid)) {
|
if (preg_match("/^\d+$/s", $pid)) {
|
||||||
if ($this->processExists((int) $pid)) {
|
if ($this->processExists((int) $pid)) {
|
||||||
throw new \Exception("Process already exists");
|
throw new \Exception("Process already exists");
|
||||||
}
|
}
|
||||||
|
@ -108,6 +108,10 @@ class Daemon {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Wrapper around posix_kill (with signal 0) to facilitation testing
|
||||||
|
*
|
||||||
|
* @codeCoverageIgnore
|
||||||
|
*/
|
||||||
protected function processExists(int $pid): bool {
|
protected function processExists(int $pid): bool {
|
||||||
return @posix_kill($pid, 0);
|
return @posix_kill($pid, 0);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue