Fray Engine
Loading...
Searching...
No Matches
process_manager.hpp File Reference
#include <cstdlib>
#include <filesystem>
#include <string>
#include <utility>
#include <vector>
#include <sys/types.h>
#include <unistd.h>
#include "errors.hpp"
#include "log_manager.hpp"
#include "types.hpp"

Go to the source code of this file.

Namespaces

namespace  fray
namespace  fray::process

Functions

F_err fray::process::spawn (const std::vector< std::string > &command, const std::filesystem::path &workingDirectory, const std::vector< std::pair< std::string, std::string > > &environment={})
 Starts a child process without waiting for it (fire and forget). The child inherits this process's stdio and the given environment variables, and runs in workingDirectory. Side effect: the variables are set in this process's own environment (not restored) before spawning, so call it while the engine is still single-threaded. On Windows the command runs through cmd /c; elsewhere it uses fork + execvp (a child that cannot chdir or exec exits with 126 / 127, which is not reported to the caller).