1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2025-01-03 19:31:02 +01:00

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
This commit is contained in:
epriestley 2012-06-02 14:05:27 -07:00
parent cb1177497e
commit 5fee8c50ee

View file

@ -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 ".
"<strong>{$documentation}</strong>.";
try {
$daemon_running = $this->isPullDaemonRunningOnThisMachine();
if ($daemon_running) {
return null;
}
$title = "Repository Daemon Not Running";
$message =
"<p>The repository daemon is not running on this machine. ".
"{$common}</p>";
} catch (CommandException $ex) {
$title = "Unable To Verify Repository Daemon";
$message =
"<p>Unable to determine if the repository daemon is running on this ".
"machine. {$common}</p>".
"<p><strong>Exception:</strong> ".
phutil_escape_html($ex->getMessage()).
"</p>";
}
$view = new AphrontErrorView();
$view->setSeverity(AphrontErrorView::SEVERITY_WARNING);
$view->setTitle('Repository Daemon Not Running');
$view->appendChild(
"<p>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 ".
"<strong>{$documentation}</strong>.</p>");
$view->setTitle($title);
$view->appendChild($message);
return $view;
}