Skip to content

Commit fedbd47

Browse files
author
epriestley
committedJun 13, 2011
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
1 parent 8ca5581 commit fedbd47

File tree

2 files changed

+12
-7
lines changed

2 files changed

+12
-7
lines changed
 

‎scripts/daemon/phabricator_daemon_launcher.php

-6
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,6 @@
2424
phutil_require_module('phabricator', 'infrastructure/daemon/control');
2525
$control = new PhabricatorDaemonControl();
2626

27-
$phd_dir = PhabricatorEnv::getEnvConfig('phd.pid-directory');
28-
$pid_dir = $phd_dir.'/pid';
29-
3027
switch (isset($argv[1]) ? $argv[1] : 'help') {
3128
case 'list':
3229
$err = $control->executeListCommand();
@@ -202,6 +199,3 @@ function phd_load_tracked_repositories() {
202199

203200
return $repositories;
204201
}
205-
206-
207-

‎src/infrastructure/daemon/control/PhabricatorDaemonControl.php

+12-1
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,18 @@ public function launchDaemon($daemon, array $argv) {
216216
}
217217

218218
protected function getControlDirectory($dir) {
219-
return PhabricatorEnv::getEnvConfig('phd.pid-directory').'/'.$dir;
219+
$path = PhabricatorEnv::getEnvConfig('phd.pid-directory').'/'.$dir;
220+
if (!Filesystem::pathExists($path)) {
221+
list($err) = exec_manual('mkdir -p %s', $path);
222+
if ($err) {
223+
throw new Exception(
224+
"phd requires the directory '{$path}' to exist, but it does not ".
225+
"exist and could not be created. Create this directory or update ".
226+
"'phd.pid-directory' in your configuration to point to an existing ".
227+
"directory.");
228+
}
229+
}
230+
return $path;
220231
}
221232

222233
protected function loadAvailableDaemonClasses() {

0 commit comments

Comments
 (0)
Failed to load comments.