daemon : do not start the daemon if the PID file is finished by a \n

git-svn-id: https://svn.fournier38.fr/svn/ProgSVN/trunk@4093 bf3deb0d-5f1a-0410-827f-c0cc1f45334c
This commit is contained in:
2018-01-30 19:51:00 +00:00
parent 6e46428c0c
commit 9109290c69

View File

@@ -51,7 +51,7 @@ class daemon
$this->runDir), 500); $this->runDir), 500);
if ($file->file_exists ($this->runDir."/$name.pid")) if ($file->file_exists ($this->runDir."/$name.pid"))
{ {
$pid = $file->file_get_contents ($this->runDir."/$name.pid"); $pid = trim ($file->file_get_contents ($this->runDir."/$name.pid"));
if (file_exists ("/proc/$pid")) if (file_exists ("/proc/$pid"))
throw new \Exception (sprintf ( throw new \Exception (sprintf (
"Can't start the daemon: already running with PID %d", $pid), 500); "Can't start the daemon: already running with PID %d", $pid), 500);