Page MenuHomePhabricator

D11040.diff
No OneTemporary

D11040.diff

diff --git a/src/daemon/PhutilDaemonOverseer.php b/src/daemon/PhutilDaemonOverseer.php
--- a/src/daemon/PhutilDaemonOverseer.php
+++ b/src/daemon/PhutilDaemonOverseer.php
@@ -107,7 +107,6 @@
$log = $args->getArg('log');
if ($log) {
- ini_set('error_log', $log);
$argv[] = '--log='.$log;
}
@@ -122,8 +121,6 @@
$this->argv = $argv;
$this->moreArgs = coalesce($more, array());
- error_log("Bringing daemon '{$this->daemon}' online...");
-
if (self::$instance) {
throw new Exception(
'You may not instantiate more than one Overseer per process.');
@@ -131,6 +128,28 @@
self::$instance = $this;
+ // Check this before we daemonize, since if it's an issue the child will
+ // exit immediately.
+ if ($this->phddir) {
+ $dir = $this->phddir;
+ try {
+ Filesystem::assertWritable($dir);
+ } catch (Exception $ex) {
+ throw new Exception(
+ "Specified daemon PID directory ('{$dir}') does not exist or is ".
+ "not writable by the daemon user!");
+ }
+ }
+
+ if ($log) {
+ // NOTE: Now that we're committed to daemonizing, redirect the error
+ // log if we have a `--log` parameter. Do this at the last moment
+ // so as many setup issues as possible are surfaced.
+ ini_set('error_log', $log);
+ }
+
+ error_log("Bringing daemon '{$this->daemon}' online...");
+
if ($this->daemonize) {
// We need to get rid of these or the daemon will hang when we TERM it

File Metadata

Mime Type
text/plain
Expires
Wed, Mar 5, 1:07 PM (5 d, 4 h ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7225601
Default Alt Text
D11040.diff (1 KB)

Event Timeline