Groundwork for running different applications
This commit is contained in:
parent
5541f9dca8
commit
d17f37db12
8 changed files with 256 additions and 15 deletions
|
|
@ -14,12 +14,36 @@ extern "C" {
|
|||
}
|
||||
|
||||
#include "config.h"
|
||||
#include "platform/common.h"
|
||||
|
||||
#include "process.h"
|
||||
|
||||
using namespace std::literals;
|
||||
int main(int argc, char *argv[]) {
|
||||
std::vector<proc::cmd_t> pre_cmds {
|
||||
{ "echo pre-1", "echo post-1" },
|
||||
{ "echo pre-2", "" },
|
||||
{ "echo pre-3", "echo post-3" }
|
||||
};
|
||||
|
||||
std::unordered_map<std::string, proc::ctx_t> map {
|
||||
{ "echo", { std::move(pre_cmds), R"(echo \"middle\")", "output.txt" } }
|
||||
};
|
||||
|
||||
boost::process::environment env = boost::this_process::environment();
|
||||
proc::proc_t proc(std::move(env), std::move(map));
|
||||
|
||||
proc.execute("echo"s);
|
||||
|
||||
std::this_thread::sleep_for(50ms);
|
||||
|
||||
proc.execute("echo"s);
|
||||
|
||||
std::this_thread::sleep_for(50ms);
|
||||
return proc.running();
|
||||
|
||||
if(argc > 1) {
|
||||
if(!std::filesystem::exists(argv[1])) {
|
||||
std::cout << "Error: Couln't find configuration file ["sv << argv[1] << ']' << std::endl;
|
||||
std::cout << "Error: Couldn't find configuration file ["sv << argv[1] << ']' << std::endl;
|
||||
return 7;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue