From 42fa9b0c0b48ae29989e6be1e91acf96ec4d4952 Mon Sep 17 00:00:00 2001 From: nicole mazzuca Date: Fri, 13 Mar 2020 13:14:38 -0700 Subject: [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 --- toolsrc/src/vcpkg/base/files.cpp | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) (limited to 'toolsrc/src') 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 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 } }; -- cgit v1.2.3