![]() |
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 >()) |
| Start the process. More... | |
| 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 const &s) |
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 >() |
||
| ) |
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
1.8.14