wex
v21.04.0
|
Offers a process, capturing execution output. More...
#include <wex/process.h>
Public Types | |
enum | exec_t { EXEC_NO_WAIT , EXEC_WAIT } |
process execute type More... | |
Public Member Functions | |
process () | |
Other methods. More... | |
virtual | ~process () |
Destructor. | |
process (const process &process) | |
Copy constructor. | |
process & | operator= (const process &p) |
Assignment operator. | |
bool | execute (const std::string &command=std::string(), exec_t type=EXEC_NO_WAIT, const std::string &wd=std::string()) |
Executes the process. More... | |
const auto & | get_exec () const |
Returns command. | |
auto * | get_frame () |
Returns the frame. | |
const auto & | get_stderr () const |
Returns the stderr. | |
const auto & | get_stdout () const |
Returns the stdout. | |
bool | is_debug () const |
Is this a debug process. | |
bool | is_running () const |
Returns true if this process is running. | |
virtual void | show_output (const std::string &caption=std::string()) const |
Shows stdout or stderr from execute on the shell component. More... | |
bool | stop () |
Stops this process. More... | |
bool | write (const std::string &text) |
Writes text to stdin of process. More... | |
Static Public Member Functions | |
static int | config_dialog (const data::window &data=data::window()) |
Static interface. More... | |
static auto * | get_shell () |
Returns the shell component (might be nullptr if prepare_output is not yet invoked). | |
static shell * | prepare_output (wxWindow *parent) |
Construct the shell component, and returns it. | |
Offers a process, capturing execution output.
enum wex::process::exec_t |
wex::process::process | ( | ) |
Other methods.
Default constructor.
|
static |
Static interface.
Shows a config dialog, allowing you to set the command and folder. Returns dialog return code.
bool wex::process::execute | ( | const std::string & | command = std::string() , |
exec_t | type = EXEC_NO_WAIT , |
||
const std::string & | wd = std::string() |
||
) |
Executes the process.
Return value is false if process could not execute, or if config dialog was invoked and cancelled.
command | command to be executed, if empty last given command is used |
type | process execute type |
wd | working dir, if empty last working dir is used |
|
virtual |
Shows stdout or stderr from execute 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.
bool wex::process::stop | ( | ) |
Stops this process.
Returns true if stop is ok.
bool wex::process::write | ( | const std::string & | text | ) |
Writes text to stdin of process.
Default the response stdout is collected in the shell,