20after4 has submitted this change and it was merged.

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.

Also fixes https://secure.phabricator.com/T9047

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

Approvals:
  Paladox: Looks good to me, but someone else must approve
  20after4: Looks good to me, approved
  Luke081515: Looks good to me, but someone else must approve
  jenkins-bot: Verified



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: merged
Gerrit-Change-Id: Ic2089404b507db1e5c209485f41d86410e018e64
Gerrit-PatchSet: 2
Gerrit-Project: phabricator/libphutil
Gerrit-Branch: stable
Gerrit-Owner: Paladox <[email protected]>
Gerrit-Reviewer: 20after4 <[email protected]>
Gerrit-Reviewer: Chad <[email protected]>
Gerrit-Reviewer: Greg Grossmeier <[email protected]>
Gerrit-Reviewer: Luke081515 <[email protected]>
Gerrit-Reviewer: Paladox <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

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

Reply via email to