16 virtual const char*
what() const noexcept
override {
17 return message.c_str();
28 }
else if (pid == 0) {
31 std::string fileName = path.
native();
33 argv.
push(
const_cast<char*
>(fileName.c_str()));
34 for (std::string& arg : args) {
35 argv.
push(
const_cast<char*
>(arg.c_str()));
39 execvp(fileName.c_str(), &argv[0]);
54 pid = waitpid(childPid, &status, 0);
55 }
while (pid != childPid && status != -1);
#define SPH_ASSERT(x,...)
#define NAMESPACE_SPH_END
Creating and managing processes.
INLINE void push(U &&u)
Adds new element to the end of the array, resizing the array if necessary.
Object representing a path on a filesystem.
std::string native() const
Returns the native version of the path.
virtual const char * what() const noexcept override
ProcessException(const std::string &message)
void wait()
Blocks the calling thread until the managed process exits. The function may block indefinitely.
Process()=default
Creates a null process handle.
bool pathExists(const Path &path)
Checks if a file or directory exists (or more precisely, if a file or directory is accessible).