From a6b270a6e0116f2975f05dc9db731885f956bdc6 Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Tue, 29 Oct 2019 19:00:12 +0300 Subject: Use environment task manifest value to locate environment setup executable --- bbot/worker/worker.cxx | 31 ++++++++++++++++++++++++------- 1 file changed, 24 insertions(+), 7 deletions(-) (limited to 'bbot') 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; -- cgit v1.1