launch::popen respects dry run flag (#27)

This commit is contained in:
Nicholas O'Connor 2017-07-05 14:19:39 -07:00
parent e735768e52
commit 96ccab40f7

View File

@ -6,6 +6,7 @@
#include <boost/algorithm/string.hpp> #include <boost/algorithm/string.hpp>
#include "subprocess.hpp" #include "subprocess.hpp"
#include "cellar.hpp"
#include "bottles.hpp" #include "bottles.hpp"
#include "launch.hpp" #include "launch.hpp"
#include "internal/launch.hpp" #include "internal/launch.hpp"
@ -48,6 +49,7 @@ void cellar::launch::popen(string argv) {
void cellar::launch::popen(vector<string> argv) { void cellar::launch::popen(vector<string> argv) {
output::statement("launching program: " + boost::algorithm::join(argv, " "), true); output::statement("launching program: " + boost::algorithm::join(argv, " "), true);
if (!dryrun) {
string exec = argv[0]; string exec = argv[0];
vector<string> subargv; vector<string> subargv;
for (int curarg = 1; curarg < argv.size(); curarg++) { for (int curarg = 1; curarg < argv.size(); curarg++) {
@ -56,4 +58,5 @@ void cellar::launch::popen(vector<string> argv) {
auto subproc = subprocess::popen(exec, subargv); auto subproc = subprocess::popen(exec, subargv);
cout << subproc.stdout().rdbuf(); cout << subproc.stdout().rdbuf();
cerr << subproc.stderr().rdbuf(); cerr << subproc.stderr().rdbuf();
}
} }