1
0
Fork 0
mirror of https://we.phorge.it/source/arcanist.git synced 2024-11-28 09:42:40 +01:00

Send arcanist error output to STDERR

Summary: Currently, arcanist error output is sent to `STDOUT` instead of `STDOUT`. This is annoying because I am running `arc lint --everything --never-apply-patches --output=xml > checkstyle.xml` and the `checkstyle.xml` file is not valid XML.

Test Plan: Forced a linter to throw an exception and ran `arc lint >/dev/null`... saw error output.

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: Korvin, epriestley

Differential Revision: https://secure.phabricator.com/D13043
This commit is contained in:
Joshua Spence 2015-05-28 09:10:32 +10:00
parent 3ac80200e2
commit 2924ebb922

View file

@ -394,10 +394,10 @@ try {
} catch (Exception $ex) { } catch (Exception $ex) {
$is_usage = ($ex instanceof ArcanistUsageException); $is_usage = ($ex instanceof ArcanistUsageException);
if ($is_usage) { if ($is_usage) {
echo phutil_console_format( fwrite(STDERR, phutil_console_format(
"**%s** %s\n", "**%s** %s\n",
pht('Usage Exception:'), pht('Usage Exception:'),
$ex->getMessage()); $ex->getMessage()));
} }
if ($config) { if ($config) {
@ -405,15 +405,15 @@ try {
} }
if ($config_trace_mode) { if ($config_trace_mode) {
echo "\n"; fwrite(STDERR, "\n");
throw $ex; throw $ex;
} }
if (!$is_usage) { if (!$is_usage) {
echo phutil_console_format("**%s**\n", pht('Exception')); fwrite(STDERR, phutil_console_format("**%s**\n", pht('Exception')));
while ($ex) { while ($ex) {
echo $ex->getMessage()."\n"; fwrite(STDERR, $ex->getMessage()."\n");
if ($ex instanceof PhutilProxyException) { if ($ex instanceof PhutilProxyException) {
$ex = $ex->getPreviousException(); $ex = $ex->getPreviousException();
@ -422,9 +422,9 @@ try {
} }
} }
echo phutil_console_format( echo fwrite(STDERR, phutil_console_format(
"(%s)\n", "(%s)\n",
pht('Run with `%s` for a full exception trace.', '--trace')); pht('Run with `%s` for a full exception trace.', '--trace')));
} }
exit(1); exit(1);