diff options
author | Karen Arutyunov <karen@codesynthesis.com> | 2019-10-29 19:00:12 +0300 |
---|---|---|
committer | Karen Arutyunov <karen@codesynthesis.com> | 2019-10-31 19:18:10 +0300 |
commit | a6b270a6e0116f2975f05dc9db731885f956bdc6 (patch) | |
tree | 1152946fc058356d0974072cc3a8dd957e670a03 /bbot/worker/worker.cxx | |
parent | 7a12f8bdcb4d497489a4df1e1024e724b316085a (diff) |
Use environment task manifest value to locate environment setup executable
Diffstat (limited to 'bbot/worker/worker.cxx')
-rw-r--r-- | bbot/worker/worker.cxx | 31 |
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; |