Add shc doc

This commit is contained in:
zawz 2020-03-03 12:34:37 +01:00
parent 4a0852b8c2
commit 861aab58cd
2 changed files with 16 additions and 2 deletions

View file

@ -52,27 +52,41 @@ namespace ztd
*/ */
int pclose2(FILE* fp, pid_t pid); int pclose2(FILE* fp, pid_t pid);
//! @brief Shell call class
class shc class shc
{ {
public: public:
//! @brief constructor
shc(std::string const& cmd="", bool const cout=false); shc(std::string const& cmd="", bool const cout=false);
virtual ~shc(); virtual ~shc();
//! @brief Start the command
void run(); void run();
//! @brief Kill the command (SIGINT)
int kill_int(); int kill_int();
//! @brief Wait until the command gives output
void wait_output(); void wait_output();
//! @brief Retrieve a line from the command's output
std::string get_output(); std::string get_output();
//! @brief Wait for the command to finish
void wait_finish(); void wait_finish();
//! @brief Command to execute
std::string command; std::string command;
//! @brief Output the command result to console
bool to_console; bool to_console;
//! @brief Run status of the command
bool running; bool running;
//! @brief PID of the command (only during execution)
pid_t pid; pid_t pid;
//! @brief Output lines of the command
std::queue<std::string> output; std::queue<std::string> output;
//! @brief Return value on the command (only after execution)
int return_value; int return_value;
ztd::wait_pool wp_output; ztd::wait_pool wp_output;

View file

@ -14,7 +14,7 @@ Everything is a string, there are no number or boolean types
### Map Chunk ### Map Chunk
A map chunk consists of pairs of keys and values. A map chunk consists of pairs of keys and values.
Key separators are \n and ; Key separators are \\n and ;
Format is as follows: Format is as follows:
``` ```
@ -161,5 +161,5 @@ catch (ztd::format_error& fe)
printFormatException(fe); printFormatException(fe);
} }
``` ```
If origin is known, printFormatException will print only the relevant line with location <br> If origin is known, printFormatException will print only the relevant line with location \n
If origin is unknown, printFormatException will print the whole data until the discriminating line If origin is unknown, printFormatException will print the whole data until the discriminating line