mirror of
https://github.com/boostorg/process.git
synced 2026-01-19 16:32:15 +00:00
36 lines
804 B
Plaintext
36 lines
804 B
Plaintext
== `error.hpp`
|
|
[#error]
|
|
|
|
The error header provides two error categories:
|
|
|
|
[source,cpp]
|
|
----
|
|
// Errors used for utf8 <-> UCS-2 conversions.
|
|
enum utf8_conv_error
|
|
{
|
|
insufficient_buffer = 1,
|
|
invalid_character,
|
|
};
|
|
|
|
extern const error_category& get_utf8_category();
|
|
static const error_category& utf8_category = get_utf8_category();
|
|
|
|
extern const error_category& get_exit_code_category();
|
|
|
|
/// An error category that can be used to interpret exit codes of subprocesses.
|
|
static const error_category& exit_code_category = get_exit_code_category();
|
|
|
|
}
|
|
----
|
|
|
|
The `get_exit_code_category` can be used as follows:
|
|
|
|
[source,cpp]
|
|
----
|
|
void run_my_process(filesystem::path pt, error_code & ec)
|
|
{
|
|
process proc(pt, {});
|
|
proc.wait();
|
|
ec.assign(proc.native_exit_code(), error::get_exit_code_category());
|
|
}
|
|
---- |