corking, and a major refactor to accomodate it
This commit is contained in:
@@ -1,8 +1,9 @@
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <boost/algorithm/string/join.hpp>
|
||||
#include <boost/algorithm/string.hpp>
|
||||
#include "subprocess.hpp"
|
||||
|
||||
#include "launch.hpp"
|
||||
@@ -28,8 +29,26 @@ void cellar::launch::launch_command(int argc, vector<string> args) {
|
||||
launch::launch_program(args);
|
||||
}
|
||||
|
||||
// BULLSHIT: subprocess.hpp throws linker errors if included in multiple files
|
||||
void cellar::launch::popen(string argv) {
|
||||
auto wine = subprocess::Popen(argv);
|
||||
wine.wait();
|
||||
vector<string> argvsplit;
|
||||
boost::algorithm::split(argvsplit, argv, boost::is_any_of(" "));
|
||||
string exec = argvsplit[0];
|
||||
vector<string> subargv;
|
||||
for (int curarg = 1; curarg < argvsplit.size(); curarg++) {
|
||||
subargv.push_back(argvsplit[curarg]);
|
||||
}
|
||||
auto subproc = subprocess::popen(exec, subargv);
|
||||
cout << subproc.stdout().rdbuf();
|
||||
cerr << subproc.stderr().rdbuf();
|
||||
}
|
||||
|
||||
void cellar::launch::popen(vector<string> argv) {
|
||||
string exec = argv[0];
|
||||
vector<string> subargv;
|
||||
for (int curarg = 1; curarg < argv.size(); curarg++) {
|
||||
subargv.push_back(argv[curarg]);
|
||||
}
|
||||
auto subproc = subprocess::popen(exec, subargv);
|
||||
cout << subproc.stdout().rdbuf();
|
||||
cerr << subproc.stderr().rdbuf();
|
||||
}
|
||||
|
@@ -6,7 +6,6 @@
|
||||
//#include "subprocess.hpp"
|
||||
|
||||
#include "bottles.hpp"
|
||||
#include "cellar.hpp"
|
||||
#include "launch.hpp"
|
||||
#include "internal/launch.hpp"
|
||||
#include "output.hpp"
|
||||
@@ -26,14 +25,14 @@ void cellar::launch::winetricks(int argc, vector<string> argv) {
|
||||
//output::statement(winetricks_str);
|
||||
launch::popen(winetricks_str);
|
||||
|
||||
if (cellar::active_bottle.config.find("winetricks") == cellar::active_bottle.config.end()) {
|
||||
cellar::active_bottle.config.emplace("winetricks", vector<string>());
|
||||
if (bottles::active_bottle.config.find("winetricks") == bottles::active_bottle.config.end()) {
|
||||
bottles::active_bottle.config.emplace("winetricks", vector<string>());
|
||||
}
|
||||
for (string winetrick : winetricks_argv) {
|
||||
if (winetrick == "winetricks") { continue; }
|
||||
else if (winetrick.substr(0,1) == "-") { continue; } // opts don't get saved
|
||||
else { cellar::active_bottle.config["winetricks"].push_back(winetrick); }
|
||||
else { bottles::active_bottle.config["winetricks"].push_back(winetrick); }
|
||||
}
|
||||
|
||||
cellar::active_bottle.save_config();
|
||||
bottles::active_bottle.save_config();
|
||||
}
|
||||
|
Reference in New Issue
Block a user