Home GnuPG

Add Filesystem::resolveBinary to lookup full path to binary file in PATH
378f7f23c84dUnpublished

Unpublished Commit ยท Learn More

Repository Importing: This repository is still importing.

Description

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

Details

Provenance
James Rhodes <jrhodes@redpointsoftware.com.au>Authored on May 31 2013, 5:53 AM
epriestley <git@epriestley.com>Committed on May 31 2013, 5:53 AM
Parents
rPHUTIL1c637275046f: Fixing phutil_utf8_shorten().
Branches
Unknown
Tags
Unknown

Event Timeline

epriestley <git@epriestley.com> committed rPHUTIL378f7f23c84d: Add Filesystem::resolveBinary to lookup full path to binary file in PATH (authored by James Rhodes <jrhodes@redpointsoftware.com.au>).May 31 2013, 5:53 AM