From c030e580940929c8f395de73507f943b9c35e0ec Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Sat, 12 May 2018 22:23:08 +0300 Subject: Fix inability to run program by relative path in testscript --- build2/test/script/runner.cxx | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/build2/test/script/runner.cxx b/build2/test/script/runner.cxx index 000b605..13f7f8a 100644 --- a/build2/test/script/runner.cxx +++ b/build2/test/script/runner.cxx @@ -1594,7 +1594,7 @@ namespace build2 catch (const system_error& e) { fail (ll) << "unable to execute " << c.program << " builtin: " - << e << endf; + << e; } } else @@ -1603,6 +1603,27 @@ namespace build2 // cstrings args (process_args ()); + // Resolve the relative not simple program path against the scope's + // working directory. The simple one will be left for the process + // path search machinery. + // + path p; + + try + { + p = path (args[0]); + + if (p.relative () && !p.simple ()) + { + p = sp.wd_path / p; + args[0] = p.string ().c_str (); + } + } + catch (const invalid_path& e) + { + fail (ll) << "invalid program path " << e.path; + } + try { process_path pp (process::path_search (args[0])); -- cgit v1.1