From ff339e152e16792d0e83623771dc7b833721c4d2 Mon Sep 17 00:00:00 2001 From: epriestley Date: Thu, 19 Jan 2012 11:06:05 -0800 Subject: [PATCH] Improve error message for "phd stop" with bad PID Summary: "phd launch ircbot" works but "phd stop ircbot" gives you a potentially confusing message. Improve messaging. Test Plan: Ran "phd stop ircbot", "phd stop 87888" (actual PID) Reviewers: btrahan, jungejason Reviewed By: btrahan CC: aran Maniphest Tasks: T791 Differential Revision: https://secure.phabricator.com/D1457 --- .../daemon/control/PhabricatorDaemonControl.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/infrastructure/daemon/control/PhabricatorDaemonControl.php b/src/infrastructure/daemon/control/PhabricatorDaemonControl.php index 2639ebe12b..6bf66dab1b 100644 --- a/src/infrastructure/daemon/control/PhabricatorDaemonControl.php +++ b/src/infrastructure/daemon/control/PhabricatorDaemonControl.php @@ -84,8 +84,11 @@ final class PhabricatorDaemonControl { } else { // We were given a PID or set of PIDs to kill. foreach ($pids as $key => $pid) { - if (empty($daemons[$pid])) { - echo "{$pid} is not Phabricator-controlled. Not killing.\n"; + if (!preg_match('/^\d+$/', $pid)) { + echo "'{$pid}' is not a valid PID.\n"; + continue; + } else if (empty($daemons[$pid])) { + echo "'{$pid}' is not Phabricator-controlled PID. Not killing.\n"; continue; } else { $running[] = $daemons[$pid];