From eba11238b9211d3c4c43e3bc550ff5adf7e5b2eb Mon Sep 17 00:00:00 2001 From: Joshua Spence <josh@joshuaspence.com> Date: Tue, 20 May 2014 16:47:47 -0700 Subject: [PATCH] Show daemon arguments with `./bin/phd status`. Summary: Fixes T4735. When running `./bin/phd`, show daemon arguments. Test Plan: ``` ./bin/phd status PID Started Daemon Arguments 12711 May 20 2014, 9:02:52 AM PhabricatorRepositoryPullLocalDaemon [] 12716 May 20 2014, 9:02:52 AM PhabricatorGarbageCollectorDaemon [] 12733 May 20 2014, 9:02:53 AM PhabricatorTaskmasterDaemon [] 12768 May 20 2014, 9:02:53 AM PhabricatorTaskmasterDaemon [] 12775 May 20 2014, 9:02:53 AM PhabricatorTaskmasterDaemon [] 12780 May 20 2014, 9:02:54 AM PhabricatorTaskmasterDaemon [] 12838 May 20 2014, 9:02:54 AM PhabricatorFactDaemon [] 13436 May 20 2014, 9:03:23 AM PhabricatorRepositoryPullLocalDaemon ["X","--not","Y"] ``` Reviewers: epriestley, #blessed_reviewers Reviewed By: epriestley, #blessed_reviewers Subscribers: epriestley, Korvin Maniphest Tasks: T4735 Differential Revision: https://secure.phabricator.com/D9208 --- .../PhabricatorDaemonManagementStatusWorkflow.php | 14 ++++++++------ .../daemon/control/PhabricatorDaemonReference.php | 6 ++++++ 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/src/applications/daemon/management/PhabricatorDaemonManagementStatusWorkflow.php b/src/applications/daemon/management/PhabricatorDaemonManagementStatusWorkflow.php index 8ba3e9777b..ef0d857c7a 100644 --- a/src/applications/daemon/management/PhabricatorDaemonManagementStatusWorkflow.php +++ b/src/applications/daemon/management/PhabricatorDaemonManagementStatusWorkflow.php @@ -23,10 +23,11 @@ final class PhabricatorDaemonManagementStatusWorkflow $status = 0; printf( - "%-5s\t%-24s\t%s\n", - "PID", - "Started", - "Daemon"); + "%-5s\t%-24s\t%-50s%s\n", + 'PID', + 'Started', + 'Daemon', + 'Arguments'); foreach ($daemons as $daemon) { $name = $daemon->getName(); if (!$daemon->isRunning()) { @@ -35,12 +36,13 @@ final class PhabricatorDaemonManagementStatusWorkflow $name = '<DEAD> '.$name; } printf( - "%5s\t%-24s\t%s\n", + "%5s\t%-24s\t%-50s%s\n", $daemon->getPID(), $daemon->getEpochStarted() ? date('M j Y, g:i:s A', $daemon->getEpochStarted()) : null, - $name); + $name, + csprintf('%LR', $daemon->getArgv())); } return $status; diff --git a/src/infrastructure/daemon/control/PhabricatorDaemonReference.php b/src/infrastructure/daemon/control/PhabricatorDaemonReference.php index 15392da9a5..679680a62e 100644 --- a/src/infrastructure/daemon/control/PhabricatorDaemonReference.php +++ b/src/infrastructure/daemon/control/PhabricatorDaemonReference.php @@ -3,6 +3,7 @@ final class PhabricatorDaemonReference { private $name; + private $argv; private $pid; private $start; private $pidFile; @@ -13,6 +14,7 @@ final class PhabricatorDaemonReference { $ref = new PhabricatorDaemonReference(); $ref->name = idx($dict, 'name', 'Unknown'); + $ref->argv = idx($dict, 'argv', array()); $ref->pid = idx($dict, 'pid'); $ref->start = idx($dict, 'start'); @@ -56,6 +58,10 @@ final class PhabricatorDaemonReference { return $this->name; } + public function getArgv() { + return $this->argv; + } + public function getEpochStarted() { return $this->start; }