aboutsummaryrefslogtreecommitdiff
path: root/bbot/worker/worker.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'bbot/worker/worker.cxx')
-rw-r--r--bbot/worker/worker.cxx31
1 files changed, 24 insertions, 7 deletions
diff --git a/bbot/worker/worker.cxx b/bbot/worker/worker.cxx
index e991910..cb47651 100644
--- a/bbot/worker/worker.cxx
+++ b/bbot/worker/worker.cxx
@@ -1356,15 +1356,31 @@ startup ()
// not apply) we still use process::path_search() to automatically handle
// appending platform-specific executable extensions (.exe/.bat, etc).
//
- string tg (tm.target.string ());
- process_path pp (process::try_path_search (env_dir / tg, false));
+ process_path pp;
+
+ if (tm.environment)
+ {
+ try
+ {
+ pp = process::try_path_search (env_dir / *tm.environment,
+ false /* init */);
+ }
+ catch (const invalid_path& e)
+ {
+ fail << "invalid environment name '" << e.path << "': " << e;
+ }
- if (pp.empty ())
- pp = process::try_path_search (env_dir / "default", false);
+ if (pp.empty ())
+ fail << "no environment setup executable in " << env_dir << " "
+ << "for environment name '" << *tm.environment << "'";
+ }
+ else
+ {
+ pp = process::try_path_search (env_dir / "default", false /* init */);
- if (pp.empty ())
- fail << "no environment setup executable in " << env_dir << " "
- << "for target '" << tg << "'";
+ if (pp.empty ())
+ fail << "no default environment setup executable in " << env_dir;
+ }
// Run it.
//
@@ -1391,6 +1407,7 @@ startup ()
// Exit code 2 signals abnormal termination but where the worker uploaded
// the result itself.
//
+ string tg (tm.target.string ());
switch (run_exit (trace, pp, tg, argv0.effect_string (), os))
{
case 2: return 1;