MySQL 8.0.40
Source Code Documentation
Process< TCallback > Class Template Reference

Runs a specified command line and calls a callback for all data that is written by the child program to its standard output. More...

Public Member Functions

 Process (std::string cmd_line, TCallback &&input_handler, DWORD pipe_size)
 
 ~Process ()
 
double get_cpu_time () const
 

Private Member Functions

void create_pipe (DWORD pipe_size)
 Creates a big pipe that will receive and buffer data coming from the child process. More...
 
void create_process (std::string cmd_line)
 Runs the actual child process. More...
 
void read_output (TCallback &&input_handler)
 Reads the child results until the pipe is not closed. More...
 

Private Attributes

HANDLE m_stdout_read_pipe = INVALID_HANDLE_VALUE
 
HANDLE m_stdout_write_pipe = INVALID_HANDLE_VALUE
 
HANDLE m_process_handle = INVALID_HANDLE_VALUE
 

Detailed Description

template<class TCallback>
class Process< TCallback >

Runs a specified command line and calls a callback for all data that is written by the child program to its standard output.

The standard error is redirected to parent standard error stream. There is no input stream redirected.

Constructor & Destructor Documentation

◆ Process()

template<class TCallback >
Process< TCallback >::Process ( std::string  cmd_line,
TCallback &&  input_handler,
DWORD  pipe_size 
)

◆ ~Process()

template<class TCallback >
Process< TCallback >::~Process

Member Function Documentation

◆ create_pipe()

template<class TCallback >
void Process< TCallback >::create_pipe ( DWORD  pipe_size)
private

Creates a big pipe that will receive and buffer data coming from the child process.

◆ create_process()

template<class TCallback >
void Process< TCallback >::create_process ( std::string  cmd_line)
private

Runs the actual child process.

◆ get_cpu_time()

template<class TCallback >
double Process< TCallback >::get_cpu_time

◆ read_output()

template<class TCallback >
void Process< TCallback >::read_output ( TCallback &&  input_handler)
private

Reads the child results until the pipe is not closed.

Runs callback for all received data.

Member Data Documentation

◆ m_process_handle

template<class TCallback >
HANDLE Process< TCallback >::m_process_handle = INVALID_HANDLE_VALUE
private

◆ m_stdout_read_pipe

template<class TCallback >
HANDLE Process< TCallback >::m_stdout_read_pipe = INVALID_HANDLE_VALUE
private

◆ m_stdout_write_pipe

template<class TCallback >
HANDLE Process< TCallback >::m_stdout_write_pipe = INVALID_HANDLE_VALUE
private

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