6
6
#include " LibuvChildProcess.h"
7
7
8
8
hx::asys::libuv::system::LibuvChildProcess::LibuvChildProcess ()
9
- : request(std::move(std::make_unique<uv_process_t >()))
10
- , options(std::move(std::make_unique<uv_process_options_t >()))
9
+ : request(new uv_process_t ())
10
+ , options(new uv_process_options_t ())
11
+ , arguments(new std::vector<char *>())
12
+ , environment(new std::vector<char *>())
13
+ , containers(new std::vector<uv_stdio_container_t >(3 ))
14
+ , currentExitCode(new std::optional<int64_t >())
11
15
, exitCallback(null())
12
16
, closeCallback(null())
13
- , containers(3 )
14
17
{
15
- hx::GCSetFinalizer (this , [](hx::Object* obj) -> void {
16
- reinterpret_cast <LibuvChildProcess*>(obj)->~LibuvChildProcess ();
17
- });
18
+ HX_OBJ_WB_NEW_MARKED_OBJECT (this );
18
19
}
19
20
20
21
hx::asys::Pid hx::asys::libuv::system::LibuvChildProcess::pid ()
@@ -69,7 +70,7 @@ void hx::asys::libuv::system::LibuvChildProcess::sendSignal(hx::EnumBase signal,
69
70
}
70
71
71
72
auto result = 0 ;
72
- if ((result = uv_process_kill (request. get () , signum)) < 0 )
73
+ if ((result = uv_process_kill (request, signum)) < 0 )
73
74
{
74
75
cbFailure (hx::asys::libuv::uv_err_to_enum (result));
75
76
}
@@ -81,9 +82,9 @@ void hx::asys::libuv::system::LibuvChildProcess::sendSignal(hx::EnumBase signal,
81
82
82
83
void hx::asys::libuv::system::LibuvChildProcess::exitCode (Dynamic cbSuccess, Dynamic cbFailure)
83
84
{
84
- if (currentExitCode. has_value ())
85
+ if (currentExitCode-> has_value ())
85
86
{
86
- cbSuccess (static_cast <int >(currentExitCode. value ()));
87
+ cbSuccess (static_cast <int >(currentExitCode-> value ()));
87
88
}
88
89
else
89
90
{
@@ -95,7 +96,7 @@ void hx::asys::libuv::system::LibuvChildProcess::close(Dynamic cbSuccess, Dynami
95
96
{
96
97
closeCallback = cbSuccess.mPtr ;
97
98
98
- uv_close (reinterpret_cast <uv_handle_t *>(request. get () ), [](uv_handle_t * handle) {
99
+ uv_close (reinterpret_cast <uv_handle_t *>(request), [](uv_handle_t * handle) {
99
100
auto gcZone = hx::AutoGCZone ();
100
101
auto process = std::unique_ptr<hx::RootedObject<hx::asys::libuv::system ::LibuvChildProcess>>(reinterpret_cast <hx::RootedObject<hx::asys::libuv::system ::LibuvChildProcess>*>(handle->data ));
101
102
auto callback = Dynamic (process->rooted ->closeCallback );
0 commit comments