Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F14351927
D11041.id.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
D11041.id.diff
View Options
diff --git a/src/applications/daemon/management/PhabricatorDaemonManagementWorkflow.php b/src/applications/daemon/management/PhabricatorDaemonManagementWorkflow.php
--- a/src/applications/daemon/management/PhabricatorDaemonManagementWorkflow.php
+++ b/src/applications/daemon/management/PhabricatorDaemonManagementWorkflow.php
@@ -221,7 +221,7 @@
$command,
$daemon_script_dir,
$this->runDaemonsAsUser);
- } catch (CommandException $e) {
+ } catch (Exception $e) {
// Retry without sudo
$console->writeOut(pht(
"sudo command failed. Starting daemon as current user\n"));
@@ -237,6 +237,7 @@
$daemon_script_dir,
$run_as_user = null) {
+ $is_sudo = false;
if ($run_as_user) {
// If anything else besides sudo should be
// supported then insert it here (runuser, su, ...)
@@ -244,11 +245,25 @@
'sudo -En -u %s -- %C',
$run_as_user,
$command);
+ $is_sudo = true;
}
$future = new ExecFuture('exec %C', $command);
// Play games to keep 'ps' looking reasonable.
$future->setCWD($daemon_script_dir);
- $future->resolvex();
+ list($stdout, $stderr) = $future->resolvex();
+
+ if ($is_sudo) {
+ // On OSX, `sudo -n` exits 0 when the user does not have permission to
+ // switch accounts without a password. This is not consistent with
+ // sudo on Linux, and seems buggy/broken. Check for this by string
+ // matching the output.
+ if (preg_match('/sudo: a password is required/', $stderr)) {
+ throw new Exception(
+ pht(
+ 'sudo exited with a zero exit code, but emitted output '.
+ 'consistent with failure under OSX.'));
+ }
+ }
}
public static function ignoreSignal($signo) {
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Dec 20, 11:30 AM (1 h, 31 m)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6910276
Default Alt Text
D11041.id.diff (1 KB)
Attached To
Mode
D11041: Detect goofy `sudo -n` output under OSX
Attached
Detach File
Event Timeline
Log In to Comment