From 5fee8c50eed5cb5817024bab19e8b1bcc70d37df Mon Sep 17 00:00:00 2001 From: epriestley Date: Sat, 2 Jun 2012 14:05:27 -0700 Subject: [PATCH] Fail more softly if we can't execute "ps" Summary: If, e.g., $PATH is broken we may not be able to run "ps". We'll explode pretty hard, currently. Instead, just show a harsher warning. Test Plan: Changed "ps auxwww" to "psq", which doesn't exist on my system. Loaded page, got warning instead of explosion. Reviewers: nathanws, vrana, btrahan Reviewed By: btrahan CC: aran Differential Revision: https://secure.phabricator.com/D2624 --- .../PhabricatorRepositoryController.php | 37 +++++++++++++------ 1 file changed, 26 insertions(+), 11 deletions(-) diff --git a/src/applications/repository/controller/PhabricatorRepositoryController.php b/src/applications/repository/controller/PhabricatorRepositoryController.php index 2a96aeaa5d..dcb62685f9 100644 --- a/src/applications/repository/controller/PhabricatorRepositoryController.php +++ b/src/applications/repository/controller/PhabricatorRepositoryController.php @@ -46,11 +46,6 @@ abstract class PhabricatorRepositoryController extends PhabricatorController { } protected function renderDaemonNotice() { - $daemon_running = $this->isPullDaemonRunningOnThisMachine(); - if ($daemon_running) { - return null; - } - $documentation = phutil_render_tag( 'a', array( @@ -59,14 +54,34 @@ abstract class PhabricatorRepositoryController extends PhabricatorController { ), 'Diffusion User Guide'); + $common = + "Without this daemon, Phabricator will not be able to import or update ". + "repositories. For instructions on starting the daemon, see ". + "{$documentation}."; + + try { + $daemon_running = $this->isPullDaemonRunningOnThisMachine(); + if ($daemon_running) { + return null; + } + $title = "Repository Daemon Not Running"; + $message = + "

The repository daemon is not running on this machine. ". + "{$common}

"; + } catch (CommandException $ex) { + $title = "Unable To Verify Repository Daemon"; + $message = + "

Unable to determine if the repository daemon is running on this ". + "machine. {$common}

". + "

Exception: ". + phutil_escape_html($ex->getMessage()). + "

"; + } + $view = new AphrontErrorView(); $view->setSeverity(AphrontErrorView::SEVERITY_WARNING); - $view->setTitle('Repository Daemon Not Running'); - $view->appendChild( - "

The repository daemon is not running on this machine. Without this ". - "daemon, Phabricator will not be able to import or update repositories. ". - "For instructions on starting the daemon, see ". - "{$documentation}.

"); + $view->setTitle($title); + $view->appendChild($message); return $view; }