Changeset View
Changeset View
Standalone View
Standalone View
src/workflow/ArcanistWorkflow.php
Show First 20 Lines • Show All 1,789 Lines • ▼ Show 20 Lines | protected function newLintEngine($engine_class = null) { | ||||
$engine = newv($engine_class, array()) | $engine = newv($engine_class, array()) | ||||
->setWorkingCopy($working_copy) | ->setWorkingCopy($working_copy) | ||||
->setConfigurationManager($config); | ->setConfigurationManager($config); | ||||
return $engine; | return $engine; | ||||
} | } | ||||
protected function openURIsInBrowser(array $uris) { | |||||
$browser = $this->getBrowserCommand(); | |||||
foreach ($uris as $uri) { | |||||
$err = phutil_passthru('%s %s', $browser, $uri); | |||||
if ($err) { | |||||
throw new ArcanistUsageException( | |||||
pht( | |||||
"Failed to open '%s' in browser ('%s'). ". | |||||
"Check your 'browser' config option.", | |||||
$uri, | |||||
$browser)); | |||||
} | |||||
} | |||||
} | |||||
private function getBrowserCommand() { | |||||
$config = $this->getConfigFromAnySource('browser'); | |||||
if ($config) { | |||||
return $config; | |||||
} | |||||
if (phutil_is_windows()) { | |||||
return 'start'; | |||||
} | |||||
$candidates = array('sensible-browser', 'xdg-open', 'open'); | |||||
// NOTE: The "open" command works well on OS X, but on many Linuxes "open" | |||||
// exists and is not a browser. For now, we're just looking for other | |||||
// commands first, but we might want to be smarter about selecting "open" | |||||
// only on OS X. | |||||
foreach ($candidates as $cmd) { | |||||
if (Filesystem::binaryExists($cmd)) { | |||||
return $cmd; | |||||
} | |||||
} | |||||
throw new ArcanistUsageException( | |||||
pht( | |||||
"Unable to find a browser command to run. Set 'browser' in your ". | |||||
"Arcanist config to specify a command to use.")); | |||||
} | |||||
} | } |