diff options
Diffstat (limited to 'libbutl/b.cxx')
-rw-r--r-- | libbutl/b.cxx | 27 |
1 files changed, 19 insertions, 8 deletions
diff --git a/libbutl/b.cxx b/libbutl/b.cxx index 74a430c..0b4472f 100644 --- a/libbutl/b.cxx +++ b/libbutl/b.cxx @@ -35,7 +35,7 @@ namespace butl void b_info (std::vector<b_project_info>& r, const vector<dir_path>& projects, - bool ext_mods, + b_info_flags fl, uint16_t verb, const function<b_callback>& cmd_callback, const path& program, @@ -81,13 +81,22 @@ namespace butl else vops.push_back ("-q"); - vector<string> ps; - ps.reserve (projects.size ()); + string spec ("info("); // Note that quoting is essential here. // - for (const dir_path& p: projects) - ps.push_back ("'" + p.representation () + "'"); + for (size_t i (0); i != projects.size(); ++i) + { + if (i != 0) + spec += ' '; + + spec += '\'' + projects[i].representation () + '\''; + } + + if ((fl & b_info_flags::subprojects) == b_info_flags::none) + spec += ",no_subprojects"; + + spec += ')'; pr = process_start_callback ( cmd_callback ? cmd_callback : [] (const char* const*, size_t) {}, @@ -96,10 +105,12 @@ namespace butl 2 /* stderr */, pp, vops, - ext_mods ? nullptr : "--no-external-modules", + ((fl & b_info_flags::ext_mods) == b_info_flags::none + ? "--no-external-modules" + : nullptr), "-s", ops, - "info:", ps); + spec); pipe.out.close (); ifdstream is (move (pipe.in), fdstream_mode::skip, ifdstream::badbit); @@ -297,7 +308,7 @@ namespace butl assert (!pr.wait ()); throw b_error ( - string ("process ") + pp.recall_string () + " " + to_string (*pr.exit), + string ("process ") + pp.recall_string () + ' ' + to_string (*pr.exit), move (pr.exit)); } catch (const process_error& e) |