32 lines
843 B
C++
32 lines
843 B
C++
#include <Void/System/Metrics.hpp>
|
|
#include <Void/System/Path.hpp>
|
|
#include <Void/System/Process.hpp>
|
|
#include <Void/System/TempDir.hpp>
|
|
|
|
#include <iostream>
|
|
|
|
int main()
|
|
{
|
|
auto tmp = Void::FileSystem::TempDir::open("void_pkg_sys_");
|
|
if (!tmp.has_value()) {
|
|
std::cerr << tmp.error().message() << '\n';
|
|
return 1;
|
|
}
|
|
const auto cfg = tmp->path() / "item.txt";
|
|
if (!Void::FileSystem::replace_file(cfg, "ok").has_value()) {
|
|
return 2;
|
|
}
|
|
auto content = Void::FileSystem::read_file_bounded(cfg);
|
|
if (!content.has_value() || *content != "ok") {
|
|
return 3;
|
|
}
|
|
Void::Process::SpawnOptions opts;
|
|
opts.executable = "/nonexistent/void/binary";
|
|
opts.search_path = false;
|
|
auto bad = Void::Process::spawn(opts);
|
|
if (bad.has_value()) {
|
|
return 4;
|
|
}
|
|
return 0;
|
|
}
|