Add Filesystem::resolveBinary to lookup full path to binary file in PATH
Summary:
Arising out of an issue with D6070, I noticed that where on Windows actually returns all of the entries in PATH that match, rather than just the first. There's three places in the code that use where directly, one of which is in phutil for Filesystem::binaryExists (where the semantics don't affect it). The other two cases exist in Arcanist; the one introduced by D6070 and one in the JSHint linter.
This adds a Filesystem::resolveBinary method which is aware of the semantics of where on Windows and which on Linux. I'm recommending that code use this method to determine absolute paths to binaries in the PATH so that we don't encounter the same issue as occurred in D6070.
Test Plan:
Run the resolveBinary unit tests. The other unit tests for Filesystem are failing on my Windows box, presumably because they're trying to do UNIXy things.
The other thing you can do is replace the explicit usage of where with Filesystem::resolveBinary, like the place it's used in D6070 and confirm that it works as expected.
Reviewers: epriestley
Reviewed By: epriestley
CC: aran, Korvin
Maniphest Tasks: T3272
Differential Revision: https://secure.phabricator.com/D6077