ProcLib 0.0.1.0
A cross-platform process runner.
Loading...
Searching...
No Matches
process.hxx
Go to the documentation of this file.
1//
2// Copyright (c) 2026 Jamie Kenyon. All Rights Reserved.
3//
4
5#pragma once
6
8
9#include <cstdint>
10#include <expected>
11#include <sys/types.h>
12
13namespace pl
14{
17 {
18 Exited,
20 };
21
30
33 {
34 public:
37
42 [[nodiscard]] auto start(std::filesystem::path const& executablePath, std::vector<std::string> const& arguments) -> std::error_code;
43
46 [[nodiscard]] auto terminate() -> std::error_code;
47
51 [[nodiscard]] auto kill(uint32_t const exitCode) -> std::error_code;
52
55 [[nodiscard]] auto wait() -> std::expected<PlatformExitStatus, std::error_code>;
56
57 private:
58 pid_t _processId{ -1 };
59 };
60} // namespace pl
A platform-specific process implementation.
Definition process.hxx:33
auto kill(uint32_t const exitCode) -> std::error_code
~PlatformProcess()
Destructor.
auto wait() -> std::expected< PlatformExitStatus, std::error_code >
auto terminate() -> std::error_code
auto start(std::filesystem::path const &executablePath, std::vector< std::string > const &arguments) -> std::error_code
Definition error.hxx:10
PlatformExitKind
The kind of raw exit status reported by the OS for a completed process.
Definition process.hxx:17
@ Exited
The process ran to completion, or was force-stopped with an OS-reported exit code.
@ Signaled
The process was stopped by a signal, with no OS-reported exit code.
Definition process.hxx:26
PlatformExitKind kind
The kind of exit status reported by the OS.
Definition process.hxx:27
int32_t value
The exit code if kind == Exited; the signal number if kind == Signaled.
Definition process.hxx:28