]> khamidou — GitHub mirrors - arcanist.git/commitdiff
Send arcanist error output to STDERR
authorJoshua Spence <josh@joshuaspence.com>
Wed, 27 May 2015 23:10:32 +0000 (09:10 +1000)
committerJoshua Spence <josh@joshuaspence.com>
Wed, 27 May 2015 23:25:44 +0000 (09:25 +1000)
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

scripts/arcanist.php

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