All checks were successful
Linux unit tests / unit-tests (push) Successful in 30s
30 lines
935 B
C++
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);
|
|
}
|