1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-09-19 16:58:48 +02:00

Create phd PID directory if it doesn't exist, and give the user a meaningful

error message if that doesn't work

Summary:
This workflow is needlessly bad right now, make it not terrible.

Also removed some related, unused code.

Test Plan:
Ran 'phd launch nice' with no directory and with a failing mkdir command.

Reviewed By: toulouse
Reviewers: hsb, toulouse, codeblock
CC: aran, toulouse
Differential Revision: 440
This commit is contained in:
epriestley 2011-06-12 21:11:32 -07:00
parent 8ca5581a9c
commit fedbd475b5
2 changed files with 12 additions and 7 deletions

View file

@ -24,9 +24,6 @@ require_once $root.'/scripts/__init_env__.php';
phutil_require_module('phabricator', 'infrastructure/daemon/control');
$control = new PhabricatorDaemonControl();
$phd_dir = PhabricatorEnv::getEnvConfig('phd.pid-directory');
$pid_dir = $phd_dir.'/pid';
switch (isset($argv[1]) ? $argv[1] : 'help') {
case 'list':
$err = $control->executeListCommand();
@ -202,6 +199,3 @@ function phd_load_tracked_repositories() {
return $repositories;
}

View file

@ -216,7 +216,18 @@ EOHELP
}
protected function getControlDirectory($dir) {
return PhabricatorEnv::getEnvConfig('phd.pid-directory').'/'.$dir;
$path = PhabricatorEnv::getEnvConfig('phd.pid-directory').'/'.$dir;
if (!Filesystem::pathExists($path)) {
list($err) = exec_manual('mkdir -p %s', $path);
if ($err) {
throw new Exception(
"phd requires the directory '{$path}' to exist, but it does not ".
"exist and could not be created. Create this directory or update ".
"'phd.pid-directory' in your configuration to point to an existing ".
"directory.");
}
}
return $path;
}
protected function loadAvailableDaemonClasses() {