$all_autofix = true;
+ $console = PhutilConsole::getConsole();
+
foreach ($results as $result) {
$result_all_autofix = $result->isAllAutofix();
$lint_result = $renderer->renderLintResult($result);
if ($lint_result) {
- echo $lint_result;
+ $console->writeOut('%s', $lint_result);
}
if ($apply_patches && $result->isPatchable()) {
// TODO: Improve the behavior here, make it more like
// difference_render().
- passthru(csprintf("diff -u %s %s", $old_file, $new_file));
+ list(, $stdout, $stderr) =
+ exec_manual("diff -u %s %s", $old_file, $new_file);
+ $console->writeOut('%s', $stdout);
+ $console->writeErr('%s', $stderr);
$prompt = phutil_console_format(
"Apply this patch to __%s__?",
$result->getPath());
- if (!phutil_console_confirm($prompt, $default_no = false)) {
+ if (!$console->confirm($prompt, $default_no = false)) {
continue;
}
}
if ($this->shouldAmendWithoutPrompt ||
($this->shouldAmendAutofixesWithoutPrompt && $all_autofix)) {
- echo phutil_console_format(
+ $console->writeOut(
"<bg:yellow>** LINT NOTICE **</bg> Automatically amending HEAD ".
"with lint patches.\n");
$amend = true;
} else {
- $amend = phutil_console_confirm("Amend HEAD with lint patches?");
+ $amend = $console->confirm("Amend HEAD with lint patches?");
}
if ($amend) {
if (!$this->getParentWorkflow()) {
if ($result_code == self::RESULT_OKAY) {
- echo $renderer->renderOkayResult();
+ $console->writeOut('%s', $renderer->renderOkayResult());
}
}
'<bg:yellow>** POSTPONED **</bg>'),
);
+ $console = PhutilConsole::getConsole();
+
$unresolved = array();
$coverage = array();
$postponed_count = 0;
$unresolved[] = $result;
} else {
if ($this->engine->shouldEchoTestResults()) {
- echo ' '.$status_codes[$result_code];
+ $duration = '';
if ($result_code == ArcanistUnitTestResult::RESULT_PASS) {
- echo ' '.self::formatTestDuration($result->getDuration());
+ $duration = ' '.self::formatTestDuration($result->getDuration());
}
- echo ' '.$result->getName()."\n";
+ $console->writeOut(
+ " %s %s\n",
+ $status_codes[$result_code].$duration,
+ $result->getName());
}
if ($result_code != ArcanistUnitTestResult::RESULT_PASS) {
if ($this->engine->shouldEchoTestResults()) {
- echo $result->getUserData()."\n";
+ $console->writeOut("%s\n", $result->getUserData());
}
$unresolved[] = $result;
}
}
}
if ($postponed_count) {
- echo sprintf("%s %s\n",
- $status_codes[ArcanistUnitTestResult::RESULT_POSTPONED],
- pht('%d test(s)', $postponed_count));
+ $console->writeOut(
+ "%s %s\n",
+ $status_codes[ArcanistUnitTestResult::RESULT_POSTPONED],
+ pht('%d test(s)', $postponed_count));
}
if ($coverage) {
$file_coverage[$file] = $coverage;
$file_reports[$file] = $report;
}
- echo "\n";
- echo phutil_console_format('__COVERAGE REPORT__');
- echo "\n";
+ $console->writeOut("\n__COVERAGE REPORT__\n");
asort($file_coverage);
foreach ($file_coverage as $file => $coverage) {
- echo phutil_console_format(
+ $console->writeOut(
" **%s%%** %s\n",
sprintf('% 3d', (int)(100 * $coverage)),
$file);
if ($this->getArgument('detailed-coverage') &&
Filesystem::pathExists($full_path) &&
is_file($full_path)) {
- echo $this->renderDetailedCoverageReport(
- Filesystem::readFile($full_path),
- $file_reports[$file]);
+ $console->writeOut(
+ '%s',
+ $this->renderDetailedCoverageReport(
+ Filesystem::readFile($full_path),
+ $file_reports[$file]));
}
}
}