AsmGrader 0.0.0
Loading...
Searching...
No Matches
traced_subprocess.hpp
Go to the documentation of this file.
1#pragma once
2
7
8#include <chrono>
9
10namespace asmgrader {
11
14{
15public:
17
18 ~TracedSubprocess() override;
19
20 Tracer& get_tracer() { return tracer_; }
21
22 const Tracer& get_tracer() const { return tracer_; }
23
26
28 Result<int> wait_for_exit(std::chrono::microseconds timeout) override;
29
30 std::optional<int> get_exit_code() const { return tracer_.get_exit_code(); }
31
32private:
33 Result<void> init_child() final;
34 Result<void> init_parent() final;
35
36 Tracer tracer_;
37};
38
39} // namespace asmgrader
std::variant wrapper for a partial implementation of C++23's expected type
Definition expected.hpp:34
Definition subprocess.hpp:21
int wait_for_exit()
Definition subprocess.cpp:57
A subprocess managed by a tracer.
Definition traced_subprocess.hpp:14
Result< RunResult > run()
Run until timeout or process exit.
Definition traced_subprocess.cpp:48
const Tracer & get_tracer() const
Definition traced_subprocess.hpp:22
~TracedSubprocess() override
Definition traced_subprocess.cpp:12
std::optional< int > get_exit_code() const
Definition traced_subprocess.hpp:30
Tracer & get_tracer()
Definition traced_subprocess.hpp:20
A lightweight wrapper of ptrace(2)
Definition tracer.hpp:49
std::optional< int > get_exit_code() const
Obtain the process exit code, or nullopt if the process has not yet exited.
Definition tracer.hpp:78
Definition asm_buffer.hpp:19