Version 0.0.2 added the variable env in json.

This commit is contained in:
unrealdragon 2026-05-20 20:41:38 +05:30
commit 709b7fd7ca

View file

@ -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)