From 26ca5cbbe357e19f62c633b016795b35691c6977 Mon Sep 17 00:00:00 2001 From: Bob Trahan Date: Wed, 20 Jun 2012 12:36:31 -0700 Subject: [PATCH] phd - on start command accurately detect if daemons are running before erroring out Summary: loadRunningDaemons loads daemons that may be running (have a file pid). other commands handle this appropriately so just make sure the start command knows whats up Test Plan: phd start, stop, reload all seemed to work just fine. Reviewers: epriestley Reviewed By: epriestley CC: aran, Korvin Maniphest Tasks: T1284 Differential Revision: https://secure.phabricator.com/D2808 --- scripts/daemon/phabricator_daemon_launcher.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/scripts/daemon/phabricator_daemon_launcher.php b/scripts/daemon/phabricator_daemon_launcher.php index 84a76bf316..b01140d1e2 100755 --- a/scripts/daemon/phabricator_daemon_launcher.php +++ b/scripts/daemon/phabricator_daemon_launcher.php @@ -56,7 +56,11 @@ switch ($command) { /* Fall Through */ case 'start': $running = $control->loadRunningDaemons(); - if ($running) { + // "running" might not mean actually running so much as was running at + // some point. ergo, do a quick grouping and only barf if daemons are + // *actually* running. + $running_dict = mgroup($running, 'isRunning'); + if (!empty($running_dict[true])) { echo phutil_console_wrap( "phd start: Unable to start daemons because daemons are already ". "running.\n".