Merge issue-40-windows-process: Windows process and handle support (closes #40)

This commit is contained in:
faumaray committed 2026-12-03 16:11:40 +03:00
commit 62c2082fb3
7 files changed
+2754 -294

No files matched your search

+21 -1
View File
@@ -17,9 +17,23 @@
#include <utility>
#include <vector>
#ifdef _WIN32
#include <memory>
#endif
namespace Void::Process
{
#ifdef _WIN32
namespace Detail
{
/// Opaque owner of the native Windows process, job and pipe state. Defined by
/// the System module implementation; it is never an integer descriptor.
struct WindowsProcess;
struct ChildAccess;
} // namespace Detail
#endif
inline constexpr std::size_t kMaxSpawnInputBytes = 256ULL * 1024ULL;
inline constexpr std::size_t kDefaultMaxStdoutBytes = 1024ULL * 1024ULL;
inline constexpr std::size_t kDefaultMaxStderrBytes = 1024ULL * 1024ULL;
@@ -100,7 +114,7 @@ struct CommunicateResult {
class Child
{
public:
Child() noexcept = default;
Child() noexcept;
Child(long long pid,
long long pgid,
bool owns_process_group,
@@ -157,6 +171,12 @@ private:
Void::System::OwnedFd stderr_{};
std::chrono::milliseconds kill_grace_{std::chrono::milliseconds{2000}};
#ifdef _WIN32
std::unique_ptr<Detail::WindowsProcess> windows_;
friend struct Detail::ChildAccess;
friend class BinarySession;
#endif
void reset_and_reap() noexcept;
};