]> khamidou — GitHub mirrors - arcanist.git/commitdiff
Fix the `ArcanistJSHintLinter::getVersion` function.
authorJoshua Spence <josh@joshuaspence.com>
Sun, 18 May 2014 01:17:47 +0000 (18:17 -0700)
committerepriestley <git@epriestley.com>
Sun, 18 May 2014 01:17:47 +0000 (18:17 -0700)
Summary: As identified by @epriestley in D9060, `jshint --version` emits version information on stderr, not stdout.

Test Plan: Ran `jshint --version` locally and verified that the version information is output to stderr.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: Korvin, epriestley

Maniphest Tasks: T4954

Differential Revision: https://secure.phabricator.com/D9173

src/lint/linter/ArcanistJSHintLinter.php

index 566cf1e89fe77c592daa786cd52883591e488bc5..89e4525911ce97f3f8de21c26db810f1a8327cf5 100644 (file)
@@ -49,11 +49,14 @@ final class ArcanistJSHintLinter extends ArcanistExternalLinter {
   }
 
   public function getVersion() {
-    list($stdout) = execx('%C --version', $this->getExecutableCommand());
+    // NOTE: `jshint --version` emits version information on stderr, not stdout.
+    list($stdout, $stderr) = execx(
+      '%C --version',
+      $this->getExecutableCommand());
 
     $matches = array();
     $regex = '/^jshint v(?P<version>\d+\.\d+\.\d+)$/';
-    if (preg_match($regex, $stdout, $matches)) {
+    if (preg_match($regex, $stderr, $matches)) {
       return $matches['version'];
     } else {
       return false;