Differential D14073 Diff 34742 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 220 Lines • ▼ Show 20 Lines | if ($debug) { | ||||
| $command, | $command, | ||||
| $daemon_script_dir, | $daemon_script_dir, | ||||
| $config, | $config, | ||||
| $this->runDaemonsAsUser); | $this->runDaemonsAsUser); | ||||
| } catch (Exception $e) { | } catch (Exception $e) { | ||||
| // Retry without sudo | // Retry without sudo | ||||
| $console->writeOut( | $console->writeOut( | ||||
| "%s\n", | "%s\n", | ||||
| pht('sudo command failed. Starting daemon as current user.')); | pht( | ||||
| '%s command failed. Starting daemon as current user.', | |||||
| 'sudo')); | |||||
| $this->executeDaemonLaunchCommand( | $this->executeDaemonLaunchCommand( | ||||
| $command, | $command, | ||||
| $daemon_script_dir, | $daemon_script_dir, | ||||
| $config); | $config); | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| Show All 22 Lines | private function executeDaemonLaunchCommand( | ||||
| if ($is_sudo) { | if ($is_sudo) { | ||||
| // On OSX, `sudo -n` exits 0 when the user does not have permission to | // On OSX, `sudo -n` exits 0 when the user does not have permission to | ||||
| // switch accounts without a password. This is not consistent with | // switch accounts without a password. This is not consistent with | ||||
| // sudo on Linux, and seems buggy/broken. Check for this by string | // sudo on Linux, and seems buggy/broken. Check for this by string | ||||
| // matching the output. | // matching the output. | ||||
| if (preg_match('/sudo: a password is required/', $stderr)) { | if (preg_match('/sudo: a password is required/', $stderr)) { | ||||
| throw new Exception( | throw new Exception( | ||||
| pht( | pht( | ||||
| 'sudo exited with a zero exit code, but emitted output '. | '%s exited with a zero exit code, but emitted output '. | ||||
| 'consistent with failure under OSX.')); | 'consistent with failure under OSX.', | ||||
| 'sudo')); | |||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| public static function ignoreSignal($signo) { | public static function ignoreSignal($signo) { | ||||
| return; | return; | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 401 Lines • Show Last 20 Lines | |||||