{"record":{"id":"bfbb735da56c862a","repo":"phacility/phabricator","slug":"s-exited-with-a-zero-exit-code-but-emitted-outpu","errorCode":null,"errorMessage":"%s exited with a zero exit code, but emitted output consistent with failure under OSX.","messagePattern":"(.+?) exited with a zero exit code, but emitted output consistent with failure under OSX\\.","errorType":"console","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"src/applications/daemon/management/PhabricatorDaemonManagementWorkflow.php","lineNumber":218,"sourceCode":"      $command = csprintf(\n        'sudo -En -u %s -- %C',\n        $run_as_user,\n        $command);\n      $is_sudo = true;\n    }\n    $future = new ExecFuture('exec %C', $command);\n    // Play games to keep 'ps' looking reasonable.\n    $future->setCWD($daemon_script_dir);\n    $future->write(json_encode($config));\n    list($stdout, $stderr) = $future->resolvex();\n\n    if ($is_sudo) {\n      // On OSX, `sudo -n` exits 0 when the user does not have permission to\n      // switch accounts without a password. This is not consistent with\n      // sudo on Linux, and seems buggy/broken. Check for this by string\n      // matching the output.\n      if (preg_match('/sudo: a password is required/', $stderr)) {\n        throw new Exception(\n          pht(\n            '%s exited with a zero exit code, but emitted output '.\n            'consistent with failure under OSX.',\n            'sudo'));\n      }\n    }\n  }\n\n  public static function ignoreSignal($signo) {\n    return;\n  }\n\n  public static function requireExtensions() {\n    self::mustHaveExtension('pcntl');\n    self::mustHaveExtension('posix');\n  }\n\n  private static function mustHaveExtension($ext) {","sourceCodeStart":200,"sourceCodeEnd":236,"githubUrl":"https://github.com/phacility/phabricator/blob/5720a38cfe95b00ca4be5016dd0d2f3195f4fa04/src/applications/daemon/management/PhabricatorDaemonManagementWorkflow.php#L200-L236","documentation":"Error \"%s exited with a zero exit code, but emitted output consistent with failure under OSX.\" thrown in phacility/phabricator.","triggerScenarios":"Thrown at src/applications/daemon/management/PhabricatorDaemonManagementWorkflow.php:218 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"5720a38cfe95b00ca4be5016dd0d2f3195f4fa04","analyzedAt":"2026-08-21T05:07:25.672Z","schemaVersion":2},"datasetVersion":"2026-08-21T11:28:35.574Z"}