wex v24.04.0
Public Member Functions | Static Public Member Functions | List of all members
wex::process Class Reference

Offers a process, capturing execution output. More...

#include <wex/vcs/process.h>

Inheritance diagram for wex::process:
Inheritance graph
[legend]

Public Member Functions

 process ()
 Default constructor.
 
virtual void show_output (const std::string &caption=std::string()) const
 Shows stdout or stderr from system on the shell component.
 
bool async_system (const process_data &data) override
 Override methods.
 
int system (const process_data &data) override
 See factory::process.
 
bool write (const std::string &text) override
 Writes text to stdin of process.
 
auto * get_frame ()
 Returns the frame.
 
- Public Member Functions inherited from wex::factory::process
 process ()
 Default constructor.
 
virtual ~process ()
 Destructor, stops running process.
 
void async_sleep_for (const std::chrono::milliseconds &ms)
 Sleeps for some milliseconds time.
 
const process_datadata () const
 Returns last or current data used by async_system or system.
 
bool is_debug () const
 Is this a debug process.
 
bool is_running () const
 Is this process running.
 
void set_handler_dbg (wxEvtHandler *eh)
 Sets debug event handler.
 
void set_handler_out (wxEvtHandler *eh)
 Sets out event handler.
 
const auto & std_err () const
 Returns the stderr.
 
const auto & std_out () const
 Returns the stdout.
 

Static Public Member Functions

static int config_dialog (const data::window &data=data::window())
 Shows a config dialog, allowing you to set the command and folder.
 
static auto * get_shell ()
 Returns the shell component (might be nullptr if prepare_output is not yet invoked).
 
static shellprepare_output (wxWindow *parent)
 Construct the shell component, and returns it.
 

Detailed Description

Offers a process, capturing execution output.

Member Function Documentation

◆ async_system()

bool wex::process::async_system ( const process_data & data)
overridevirtual

Override methods.

See factory::process. Return value is false if process could not execute, or if config dialog was invoked and cancelled, or prepare_output not yet invoked.

Reimplemented from wex::factory::process.

◆ config_dialog()

static int wex::process::config_dialog ( const data::window & data = data::window())
static

Shows a config dialog, allowing you to set the command and folder.

Returns dialog return code.

◆ show_output()

virtual void wex::process::show_output ( const std::string & caption = std::string()) const
virtual

Shows stdout or stderr from system on the shell component.

You can override this method to e.g. prepare a lexer on get_shell before calling this base method.

Reimplemented in wex::vcs_entry.

◆ write()

bool wex::process::write ( const std::string & text)
overridevirtual

Writes text to stdin of process.

The response stdout is collected in the shell.

Reimplemented from wex::factory::process.