feat(System): harden OwnedFd/Child process spawn, full-duplex bounds, durable replace_file, safe TempFile/TempDir, and SystemOnly consumer (M-SYSTEM-01, M-SYSTEM-02, M-SYSTEM-05)

This commit is contained in:
faumaray committed 2026-11-24 14:32:05 +03:00
1 parent 3f67b1ecb7
commit fcdbc063b2
14 files changed
+3538 -890

No files matched your search

+11
View File
@@ -0,0 +1,11 @@
cmake_minimum_required(VERSION 4.0)
project(VoidSystemOnlyConsumer LANGUAGES CXX)
find_package(Void CONFIG REQUIRED COMPONENTS System)
add_executable(void_system_only_consumer main.cpp)
target_link_libraries(void_system_only_consumer PRIVATE Void::System)
target_compile_features(void_system_only_consumer PRIVATE cxx_std_26)
enable_testing()
add_test(NAME SystemOnlyConsumer COMMAND void_system_only_consumer)
+31
View File
@@ -0,0 +1,31 @@
#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;
}