From 1651be91ec0ff8163832f8c71857d35a8d65e120 Mon Sep 17 00:00:00 2001 From: epriestley Date: Mon, 16 Jan 2012 12:37:14 -0800 Subject: [PATCH] Remove daemon PID files for missing daemons when running "phd stop" Summary: When we try to kill a daemon but discover it isn't running, we should remove the PID file. We can also simplify the logic here. Test Plan: Ran "phd stop" a couple of times, subsequent runs did not try to stop a legion of dead daemons. Reviewers: btrahan, jungejason Reviewed By: btrahan CC: aran Maniphest Tasks: T781 Differential Revision: https://secure.phabricator.com/D1421 --- .../daemon/control/PhabricatorDaemonControl.php | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/infrastructure/daemon/control/PhabricatorDaemonControl.php b/src/infrastructure/daemon/control/PhabricatorDaemonControl.php index d330c26dd2..2639ebe12b 100644 --- a/src/infrastructure/daemon/control/PhabricatorDaemonControl.php +++ b/src/infrastructure/daemon/control/PhabricatorDaemonControl.php @@ -1,7 +1,7 @@ $daemon) { $pid = $daemon->getPID(); $name = $daemon->getName(); @@ -109,7 +110,6 @@ final class PhabricatorDaemonControl { unset($running[$key]); } else { posix_kill($pid, SIGINT); - $killed[] = $daemon; } } @@ -132,10 +132,9 @@ final class PhabricatorDaemonControl { $pid = $daemon->getPID(); echo "KILLing daemon {$pid}.\n"; posix_kill($pid, SIGKILL); - $killed[] = $daemon; } - foreach ($killed as $daemon) { + foreach ($all_daemons as $daemon) { if ($daemon->getPIDFile()) { Filesystem::remove($daemon->getPIDFile()); }