aboutsummaryrefslogtreecommitdiff
path: root/libbuild2/utility.hxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2019-10-09 12:08:45 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2019-10-09 12:08:45 +0200
commit66de0d06e5b6c002cbc7d18e18685e3ea44d3848 (patch)
tree34688ee9d0c4d00de0f58e2f6f017f026a23abe6 /libbuild2/utility.hxx
parent09e0cf71552d7f6e4f864b997db9913b9e9ae187 (diff)
Prepend pattern search paths to PATH when running binutils
This way any dependent tools (such as mt.exe that is invoked by link.exe) are first search for in there.
Diffstat (limited to 'libbuild2/utility.hxx')
-rw-r--r--libbuild2/utility.hxx34
1 files changed, 19 insertions, 15 deletions
diff --git a/libbuild2/utility.hxx b/libbuild2/utility.hxx
index c362b34..980c31f 100644
--- a/libbuild2/utility.hxx
+++ b/libbuild2/utility.hxx
@@ -280,18 +280,20 @@ namespace build2
inline void
run (const process_path& p,
const char* args[],
- const dir_path& cwd = dir_path ())
+ const dir_path& cwd = dir_path (),
+ const char* const* env = nullptr)
{
- process pr (run_start (p, args, 0 /* stdin */, 1 /* stdout */, true, cwd));
+ process pr (run_start (process_env (p, env), args, 0, 1, true, cwd));
run_finish (args, pr);
}
inline void
run (const process_path& p,
cstrings& args,
- const dir_path& cwd = dir_path ())
+ const dir_path& cwd = dir_path (),
+ const char* const* env = nullptr)
{
- run (p, args.data (), cwd);
+ run (p, args.data (), cwd, env);
}
// As above, but search for the process (including updating args[0]) and
@@ -304,10 +306,14 @@ namespace build2
int out,
bool error = true,
const dir_path& cwd = dir_path (),
+ const char* const* env = nullptr,
const location& l = location ())
{
process_path pp (run_search (args[0], l));
- return run_start (verbosity, pp, args, in, out, error, cwd, l);
+ return run_start (verbosity,
+ process_env (pp, env), args,
+ in, out, error,
+ cwd, l);
}
inline process
@@ -317,31 +323,29 @@ namespace build2
int out,
bool error = true,
const dir_path& cwd = dir_path (),
+ const char* const* env = nullptr,
const location& l = location ())
{
- return run_start (verbosity, args.data (), in, out, error, cwd, l);
+ return run_start (verbosity, args.data (), in, out, error, cwd, env, l);
}
inline void
run (uint16_t verbosity,
const char* args[],
- const dir_path& cwd = dir_path ())
+ const dir_path& cwd = dir_path (),
+ const char* const* env = nullptr)
{
- process pr (run_start (verbosity,
- args,
- 0 /* stdin */,
- 1 /* stdout */,
- true,
- cwd));
+ process pr (run_start (verbosity, args, 0, 1, true, cwd, env));
run_finish (args, pr);
}
inline void
run (uint16_t verbosity,
cstrings& args,
- const dir_path& cwd = dir_path ())
+ const dir_path& cwd = dir_path (),
+ const char* const* env = nullptr)
{
- run (verbosity, args.data (), cwd);
+ run (verbosity, args.data (), cwd, env);
}
// Start the process as above and then call the specified function on each