![]() |
libfilezilla
|
The process class manages an asynchronous process with redirected IO. More...
#include <process.hpp>
Public Member Functions | |
| process (process const &)=delete | |
| process & | operator= (process const &)=delete |
| bool | spawn (native_string const &cmd, std::vector< native_string > const &args=std::vector< native_string >(), bool redirect_io=true) |
| Start the process. More... | |
| bool | spawn (std::vector< native_string > const &command_with_args, bool redirect_io=true) |
| void | kill () |
| Stops the spawned process. More... | |
| int | read (char *buffer, unsigned int len) |
| Read data from process. More... | |
| bool | write (char const *buffer, unsigned int len) |
| Write data data process. More... | |
| bool | write (std::string_view const &s) |
| HANDLE | handle () const |
| Returns the HANDLE of the process. | |
The process class manages an asynchronous process with redirected IO.
No console window is being created.
To use, spawn the process and, since it's blocking, call read from a different thread.
| void kill | ( | ) |
Stops the spawned process.
This function doesn't actually kill the process, it merely closes the pipes.
Blocks until the process has quit.
| int read | ( | char * | buffer, |
| unsigned int | len | ||
| ) |
Read data from process.
This function blocks
| bool spawn | ( | native_string const & | cmd, |
| std::vector< native_string > const & | args = std::vector< native_string >(), |
||
| bool | redirect_io = true |
||
| ) |
Start the process.
This function takes care of properly quoting and escaping the the program's path and its arguments. Fails if process has already been spawned.
| cmd | The path of the program to execute |
| args | The command-line arguments for the process. |
true even if the process cannot be started. In that case, trying to read from the process will fail with an error or EOF. | bool write | ( | char const * | buffer, |
| unsigned int | len | ||
| ) |
Write data data process.
This function blocks