Add exitStatus parameter to ExitEvent
This commit is contained in:
parent
da93c1fc0a
commit
652950da38
@ -45,8 +45,14 @@ enum class UVStdIOFlags: std::underlying_type_t<uv_stdio_flags> {
|
||||
*
|
||||
* It will be emitted by ProcessHandle according with its functionalities.
|
||||
*/
|
||||
struct ExitEvent: Event<ExitEvent> {};
|
||||
struct ExitEvent: Event<ExitEvent> {
|
||||
explicit ExitEvent(int64_t exit_status, int term_signal) noexcept
|
||||
: exitStatus{exit_status}, termSignal{term_signal}
|
||||
{}
|
||||
|
||||
int64_t exitStatus; /*!< the exit status. */
|
||||
int termSignal; /*!< the signal that caused the process to terminate, if any. */
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief The ProcessHandle handle.
|
||||
@ -57,7 +63,7 @@ struct ExitEvent: Event<ExitEvent> {};
|
||||
class ProcessHandle final: public Handle<ProcessHandle, uv_process_t> {
|
||||
static void exitCallback(uv_process_t *handle, int64_t exitStatus, int termSignal) {
|
||||
ProcessHandle &process = *(static_cast<ProcessHandle*>(handle->data));
|
||||
process.publish(ExitEvent{});
|
||||
process.publish(ExitEvent{exitStatus, termSignal});
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
Loading…
Reference in New Issue
Block a user