Files
iZo/tests/process.cpp
GigabiteStudios 80c6bfce90
All checks were successful
Linux unit tests / unit-tests (push) Successful in 30s
docs(api): migrate consumers to CamelCase
2026-06-18 19:40:23 -05:00

30 lines
935 B
C++

#include "test_support.hpp"
#include <izo/Process.hpp>
#include <fstream>
int main() {
std::string marker;
auto result = izo::LaunchProcess({});
CHECK(!result);
CHECK(!result.errorMessage.empty());
result = izo::LaunchProcess({"/izo/missing-executable", {}, {}, false});
CHECK(!result);
CHECK(!result.errorMessage.empty());
const auto directory = test_directory("process");
result = izo::LaunchProcess({"/bin/sh", {"-c", "printf launched > marker.txt"}, directory, false});
CHECK(result);
CHECK(result.processId > 0);
CHECK(wait_until([&] { return std::filesystem::exists(directory / "marker.txt"); }));
std::ifstream(directory / "marker.txt") >> marker;
CHECK(marker == "launched");
result = izo::LaunchProcess({"/bin/true", {}, directory / "missing", false});
CHECK(!result);
CHECK(!result.errorMessage.empty());
std::filesystem::remove_all(directory);
}