Changeset View
Changeset View
Standalone View
Standalone View
src/workflow/ArcanistWorkflow.php
Show First 20 Lines • Show All 2,445 Lines • ▼ Show 20 Lines | if (!strlen($raw_uri->getDomain())) { | ||||
->setPath($raw_uri->getPath()); | ->setPath($raw_uri->getPath()); | ||||
} | } | ||||
$raw_uri = phutil_string_cast($raw_uri); | $raw_uri = phutil_string_cast($raw_uri); | ||||
return $raw_uri; | return $raw_uri; | ||||
} | } | ||||
final public function writeToPager($corpus) { | |||||
$is_tty = (function_exists('posix_isatty') && posix_isatty(STDOUT)); | |||||
if (!$is_tty) { | |||||
echo $corpus; | |||||
} else { | |||||
$pager = $this->getConfig('pager'); | |||||
if (!$pager) { | |||||
$pager = array('less', '-R', '--'); | |||||
} | |||||
// Try to show the content through a pager. | |||||
$err = id(new PhutilExecPassthru('%Ls', $pager)) | |||||
->write($corpus) | |||||
->resolve(); | |||||
// If the pager exits with an error, print the content normally. | |||||
if ($err) { | |||||
echo $corpus; | |||||
} | |||||
} | |||||
return $this; | |||||
} | |||||
} | } |