Version 0.0.2 added the variable env in json.
This commit is contained in:
parent
cc12b4765c
commit
709b7fd7ca
1 changed files with 61 additions and 8 deletions
|
|
@ -8,6 +8,7 @@ extern "C" {
|
|||
#include <fcntl.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/wait.h>
|
||||
#include <stdlib.h>
|
||||
}
|
||||
|
||||
ExecutionManager::ExecutionManager(int threads) :
|
||||
|
|
@ -117,15 +118,18 @@ void ExecutionManager::run()
|
|||
long long size = 0;
|
||||
if(log_file_exists)
|
||||
size = std::filesystem::file_size(program_log_file);
|
||||
|
||||
// Do fork and run
|
||||
auto pid = fork();
|
||||
FILE *popen_file = nullptr;
|
||||
std::unordered_map<std::string,std::string> env = ptr->getEnv();
|
||||
switch(pid) {
|
||||
case 0: {
|
||||
if(!dir.empty()) {
|
||||
int err = chdir(dir.c_str());
|
||||
}
|
||||
for(auto &[key,value]: env) {
|
||||
setenv(key.data(), value.data(), 1);
|
||||
}
|
||||
if(create_log) {
|
||||
int output_fd = -99;
|
||||
if(!log_file_exists)
|
||||
|
|
|
|||
Loading…
Reference in a new issue