diff options
| author | Lexi Winter <lexi@le-fay.org> | 2025-07-01 17:07:04 +0100 |
|---|---|---|
| committer | Lexi Winter <lexi@le-fay.org> | 2025-07-01 17:07:04 +0100 |
| commit | 2e2d1bd3b6c7776b77c33b94f30ead89367a71e6 (patch) | |
| tree | 54d37ffadf8e677938d9b7a28e4e9b71be1e75c1 /nihil.posix/process.ccm | |
| parent | 36427c0966faa7aecd586b397ed9b845f18172f5 (diff) | |
| download | nihil-2e2d1bd3b6c7776b77c33b94f30ead89367a71e6.tar.gz nihil-2e2d1bd3b6c7776b77c33b94f30ead89367a71e6.tar.bz2 | |
add nihil.std
Diffstat (limited to 'nihil.posix/process.ccm')
| -rw-r--r-- | nihil.posix/process.ccm | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/nihil.posix/process.ccm b/nihil.posix/process.ccm index ee7de15..9fbf34c 100644 --- a/nihil.posix/process.ccm +++ b/nihil.posix/process.ccm @@ -1,19 +1,17 @@ // This source code is released into the public domain. module; -#include <expected> -#include <optional> -#include <system_error> -#include <utility> - #include <sys/wait.h> export module nihil.posix:process; +import nihil.std; import nihil.error; namespace nihil { +export struct process; + // wait_result: the exit status of a process. export struct wait_result final { @@ -58,7 +56,7 @@ private: }; // Represents a process we created, which can be waited for. -export struct process final +struct process final { process() = delete; @@ -83,7 +81,8 @@ export struct process final // Movable. process(process &&other) noexcept : m_pid(std::exchange(other.m_pid, -1)) - {} + { + } auto operator=(this process &self, process &&other) noexcept -> process & { @@ -113,7 +112,7 @@ export struct process final auto status = int{}; auto ret = waitpid(self.m_pid, &status, 0); if (ret == -1) - return std::unexpected(error(std::errc(errno))); + return error(sys_error()); return wait_result(status); } |
