aboutsummaryrefslogtreecommitdiff
path: root/build2/cli
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2018-11-05 15:25:59 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2018-11-05 15:25:59 +0200
commitbe2774dd81da77661511280fda868a02e4be87eb (patch)
treeb01c55a25027573049d7d051264b749cc2de9676 /build2/cli
parent3585bd0ea3e7a32f8dc3e634b4358d822d9ee018 (diff)
Only search for external tools (compilers, linkers, etc) in PATH
Specifically, omit the current executable's directory on Windows since there is no reason for them to be found there automagically and this can lead to surprising behavior (for example, our MinGW GCC being used instead of the user's even though the user's is in PATH before ours).
Diffstat (limited to 'build2/cli')
-rw-r--r--build2/cli/init.cxx8
1 files changed, 7 insertions, 1 deletions
diff --git a/build2/cli/init.cxx b/build2/cli/init.cxx
index bad2533..d9fec08 100644
--- a/build2/cli/init.cxx
+++ b/build2/cli/init.cxx
@@ -118,7 +118,13 @@ namespace build2
try
{
- pp = process::path_search (cli, true); // Can throw.
+ // Only search in PATH (specifically, omitting the current
+ // executable's directory on Windows).
+ //
+ pp = process::path_search (cli,
+ true /* init */,
+ dir_path () /* fallback */,
+ true /* path_only */);
args[0] = pp.recall_string ();
if (verb >= 3)