Differential D21769 Diff 51905 src/applications/daemon/management/PhabricatorDaemonManagementWorkflow.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/daemon/management/PhabricatorDaemonManagementWorkflow.php
Show First 20 Lines • Show All 87 Lines • ▼ Show 20 Lines | if (!$run_as_current_user) { | ||||
$current_user = posix_getpwuid(posix_geteuid()); | $current_user = posix_getpwuid(posix_geteuid()); | ||||
$current_user = $current_user['name']; | $current_user = $current_user['name']; | ||||
if ($phd_user && $phd_user != $current_user) { | if ($phd_user && $phd_user != $current_user) { | ||||
if ($debug) { | if ($debug) { | ||||
throw new PhutilArgumentUsageException( | throw new PhutilArgumentUsageException( | ||||
pht( | pht( | ||||
"You are trying to run a daemon as a nonstandard user, ". | "You are trying to run a daemon as a nonstandard user, ". | ||||
"and `%s` was not able to `%s` to the correct user. \n". | "and `%s` was not able to `%s` to the correct user. \n". | ||||
'Phabricator is configured to run daemons as "%s", '. | 'The daemons are configured to run as "%s", '. | ||||
'but the current user is "%s". '."\n". | 'but the current user is "%s". '."\n". | ||||
'Use `%s` to run as a different user, pass `%s` to ignore this '. | 'Use `%s` to run as a different user, pass `%s` to ignore this '. | ||||
'warning, or edit `%s` to change the configuration.', | 'warning, or edit `%s` to change the configuration.', | ||||
'phd', | 'phd', | ||||
'sudo', | 'sudo', | ||||
$phd_user, | $phd_user, | ||||
$current_user, | $current_user, | ||||
'sudo', | 'sudo', | ||||
▲ Show 20 Lines • Show All 44 Lines • ▼ Show 20 Lines | final protected function launchDaemons( | ||||
if ($debug) { | if ($debug) { | ||||
// Don't terminate when the user sends ^C; it will be sent to the | // Don't terminate when the user sends ^C; it will be sent to the | ||||
// subprocess which will terminate normally. | // subprocess which will terminate normally. | ||||
pcntl_signal( | pcntl_signal( | ||||
SIGINT, | SIGINT, | ||||
array(__CLASS__, 'ignoreSignal')); | array(__CLASS__, 'ignoreSignal')); | ||||
echo "\n phabricator/scripts/daemon/ \$ {$command}\n\n"; | echo "\n scripts/daemon/ \$ {$command}\n\n"; | ||||
$tempfile = new TempFile('daemon.config'); | $tempfile = new TempFile('daemon.config'); | ||||
Filesystem::writeFile($tempfile, json_encode($config)); | Filesystem::writeFile($tempfile, json_encode($config)); | ||||
phutil_passthru( | phutil_passthru( | ||||
'(cd %s && exec %C < %s)', | '(cd %s && exec %C < %s)', | ||||
$daemon_script_dir, | $daemon_script_dir, | ||||
$command, | $command, | ||||
▲ Show 20 Lines • Show All 408 Lines • ▼ Show 20 Lines | if (!$pids) { | ||||
foreach ($pids as $key => $pid) { | foreach ($pids as $key => $pid) { | ||||
if (!preg_match('/^\d+$/', $pid)) { | if (!preg_match('/^\d+$/', $pid)) { | ||||
$console->writeErr(pht("PID '%s' is not a valid PID.", $pid)."\n"); | $console->writeErr(pht("PID '%s' is not a valid PID.", $pid)."\n"); | ||||
continue; | continue; | ||||
} else if (empty($running_pids[$pid])) { | } else if (empty($running_pids[$pid])) { | ||||
$console->writeErr( | $console->writeErr( | ||||
"%s\n", | "%s\n", | ||||
pht( | pht( | ||||
'PID "%d" is not a known Phabricator daemon PID.', | 'PID "%d" is not a known daemon PID.', | ||||
$pid)); | $pid)); | ||||
continue; | continue; | ||||
} else { | } else { | ||||
$select_pids[$pid] = $pid; | $select_pids[$pid] = $pid; | ||||
} | } | ||||
} | } | ||||
} | } | ||||
Show All 21 Lines |