WIP: review process

This commit is contained in:
Michele Caini 2017-08-18 17:44:14 +02:00
parent 97e0830794
commit 383182e4b0
2 changed files with 18 additions and 2 deletions

View File

@ -111,8 +111,9 @@ public:
* @return True in case of success, false otherwise.
*/
bool init() {
// fake initialization so as to have leak invoked
return initialize([](auto...){ return 0; });
// deferred initialization: libuv initializes process handles only when
// uv_spawn is invoked and uvw stays true to the underlying library
return true;
}
/**
@ -155,6 +156,10 @@ public:
po.stdio_count = static_cast<decltype(po.stdio_count)>(poStdio.size());
po.stdio = poStdio.data();
// fake initialization so as to have leak invoked
// see init member function for more details
initialize([](auto...){ return 0; });
invoke(&uv_spawn, parent(), get(), &po);
}

View File

@ -2,6 +2,17 @@
#include <uvw.hpp>
TEST(Process, StdIO) {
auto loop = uvw::Loop::getDefault();
auto handle = loop->resource<uvw::ProcessHandle>();
auto pipe = loop->resource<uvw::PipeHandle>();
handle->stdio(*pipe, uvw::Flags<uvw::ProcessHandle::StdIO>::from<uvw::ProcessHandle::StdIO::CREATE_PIPE, uvw::ProcessHandle::StdIO::READABLE_PIPE>());
pipe->close();
loop->run();
}
TEST(Process, TODO) {
auto loop = uvw::Loop::getDefault();
auto handle = uvw::ProcessHandle::create(loop);