AsmGrader 0.0.0
Loading...
Searching...
No Matches
asmgrader::TracedSubprocess Class Reference

A subprocess managed by a tracer. More...

#include <traced_subprocess.hpp>

Inheritance diagram for asmgrader::TracedSubprocess:
[legend]

Public Member Functions

 ~TracedSubprocess () override
 
Tracerget_tracer ()
 
const Tracerget_tracer () const
 
Result< RunResultrun ()
 Run until timeout or process exit.
 
Result< int > wait_for_exit (std::chrono::microseconds timeout) override
 Blocks until exit or timeout.
 
std::optional< int > get_exit_code () const
 
 Subprocess (std::string exec, std::vector< std::string > args)
 Creates a sub (child) process by running exec with args ENV variables remain as default for for the child process.
 
 Subprocess (Subprocess &&) noexcept
 
 Subprocess ()=default
 
- Public Member Functions inherited from asmgrader::Subprocess
 Subprocess (std::string exec, std::vector< std::string > args)
 Creates a sub (child) process by running exec with args ENV variables remain as default for for the child process.
 
virtual ~Subprocess ()
 
 Subprocess (Subprocess &&) noexcept
 
Subprocessoperator= (Subprocess &&) noexcept
 
template<typename Rep , typename Period >
Result< std::string > read_stdout (const std::chrono::duration< Rep, Period > &timeout)
 
Result< std::string > read_stdout ()
 
const std::string & get_full_stdout ()
 Get all stdout since the program has launched.
 
Result< void > send_stdin (const std::string &str)
 
virtual Result< void > start ()
 
int wait_for_exit ()
 
bool is_alive () const
 Whether child process is alive.
 
Result< void > close_pipes ()
 Close stdout and stdin pipes to child Useful for when the child is blocking on a read to stdin.
 
pid_t get_pid () const
 
std::optional< int > get_exit_code () const
 
virtual Result< void > kill ()
 Manually kill subprocess with SIGKILL.
 
virtual Result< void > restart ()
 

Additional Inherited Members

- Protected Member Functions inherited from asmgrader::Subprocess
 Subprocess ()=default
 
virtual Result< void > create (const std::string &exec, const std::vector< std::string > &args)
 

Detailed Description

A subprocess managed by a tracer.

Constructor & Destructor Documentation

◆ ~TracedSubprocess()

asmgrader::TracedSubprocess::~TracedSubprocess ( )
override

Member Function Documentation

◆ get_exit_code()

std::optional< int > asmgrader::TracedSubprocess::get_exit_code ( ) const
inline

◆ get_tracer() [1/2]

Tracer & asmgrader::TracedSubprocess::get_tracer ( )
inline

◆ get_tracer() [2/2]

const Tracer & asmgrader::TracedSubprocess::get_tracer ( ) const
inline

◆ run()

Result< RunResult > asmgrader::TracedSubprocess::run ( )

Run until timeout or process exit.

◆ Subprocess() [1/3]

asmgrader::Subprocess::Subprocess ( )
default

◆ Subprocess() [2/3]

asmgrader::Subprocess::Subprocess ( std::string exec,
std::vector< std::string > args )
explicit

Creates a sub (child) process by running exec with args ENV variables remain as default for for the child process.

◆ Subprocess() [3/3]

asmgrader::Subprocess::Subprocess ( Subprocess && other)
noexcept

◆ wait_for_exit()

Result< int > asmgrader::TracedSubprocess::wait_for_exit ( std::chrono::microseconds timeout)
overridevirtual

Blocks until exit or timeout.

Reimplemented from asmgrader::Subprocess.


The documentation for this class was generated from the following files: