Paladox has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/285138

Change subject: Fix libphutil on windows
......................................................................

Fix libphutil on windows

the where command only works on cmd not on git for windows or any linux
like programes on windows.

This caused arc lint to fail for php code.

See https://phabricator.wikimedia.org/P2949

I tested this patch and now it works.

Since we should use the which command on git for windows or any other
linux like programes.

This may fix any other command that relies on this bit since it should now
pass correctly on windows in either client you use.

Change-Id: Ic2089404b507db1e5c209485f41d86410e018e64
---
M src/filesystem/Filesystem.php
1 file changed, 13 insertions(+), 9 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/phabricator/libphutil 
refs/changes/38/285138/1

diff --git a/src/filesystem/Filesystem.php b/src/filesystem/Filesystem.php
index 0abd41e..7d371c5 100644
--- a/src/filesystem/Filesystem.php
+++ b/src/filesystem/Filesystem.php
@@ -947,18 +947,22 @@
    */
   public static function resolveBinary($binary) {
     if (phutil_is_windows()) {
-      list($err, $stdout) = exec_manual('where %s', $binary);
-      $stdout = phutil_split_lines($stdout);
+      if (substr(getenv('SHELL'), -4) === 'bash') {
+        list($err, $stdout) = exec_manual('which %s', $binary);
+      } else {
+        list($err, $stdout) = exec_manual('where %s', $binary);
+        $stdout = phutil_split_lines($stdout);
 
-      // If `where %s` could not find anything, check for relative binary
-      if ($err) {
-        $path = self::resolvePath($binary);
-        if (self::pathExists($path)) {
-          return $path;
+        // If `where %s` could not find anything, check for relative binary
+        if ($err) {
+          $path = self::resolvePath($binary);
+          if (self::pathExists($path)) {
+            return $path;
+          }
+          return null;
         }
-        return null;
+        $stdout = head($stdout);
       }
-      $stdout = head($stdout);
     } else {
       list($err, $stdout) = exec_manual('which %s', $binary);
     }

-- 
To view, visit https://gerrit.wikimedia.org/r/285138
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic2089404b507db1e5c209485f41d86410e018e64
Gerrit-PatchSet: 1
Gerrit-Project: phabricator/libphutil
Gerrit-Branch: stable
Gerrit-Owner: Paladox <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to