diff options
| author | nicole mazzuca <mazzucan@outlook.com> | 2020-03-13 13:14:38 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-03-13 13:14:38 -0700 |
| commit | 42fa9b0c0b48ae29989e6be1e91acf96ec4d4952 (patch) | |
| tree | 48d21c341325129b4dcc77efa4663628bc9497cf | |
| parent | b2e928f19b517f2b60ba2a9655cbd646185d7231 (diff) | |
| download | vcpkg-42fa9b0c0b48ae29989e6be1e91acf96ec4d4952.tar.gz vcpkg-42fa9b0c0b48ae29989e6be1e91acf96ec4d4952.zip | |
[vcpkg] Fix tool lookup without `which` (#10375)
On Linux and macOS, if `which` is not installed (notably in Amazon's
amazonlinux docker base image), vcpkg fails to find system-installed
versions of tools. This is an issue when we don't attempt to install our
own versions of the tools, like with git (we fail to find any version of
git, and thus can't install any ports which come from a git repository).
Fixes #9927
| -rw-r--r-- | toolsrc/src/vcpkg/base/files.cpp | 14 |
1 files changed, 4 insertions, 10 deletions
diff --git a/toolsrc/src/vcpkg/base/files.cpp b/toolsrc/src/vcpkg/base/files.cpp index 3d7df1a68..cd8fba129 100644 --- a/toolsrc/src/vcpkg/base/files.cpp +++ b/toolsrc/src/vcpkg/base/files.cpp @@ -666,6 +666,10 @@ namespace vcpkg::Files #if defined(_WIN32) static constexpr StringLiteral EXTS[] = {".cmd", ".exe", ".bat"}; auto paths = Strings::split(System::get_environment_variable("PATH").value_or_exit(VCPKG_LINE_INFO), ";"); +#else + static constexpr StringLiteral EXTS[] = {""}; + auto paths = Strings::split(System::get_environment_variable("PATH").value_or_exit(VCPKG_LINE_INFO), ":"); +#endif std::vector<fs::path> ret; std::error_code ec; @@ -684,16 +688,6 @@ namespace vcpkg::Files } return ret; -#else - const std::string cmd = Strings::concat("which ", name); - auto out = System::cmd_execute_and_capture_output(cmd); - if (out.exit_code != 0) - { - return {}; - } - - return Util::fmap(Strings::split(out.output, "\n"), [](auto&& s) { return fs::path(s); }); -#endif } }; |
