From 74a664b22f2caf3ea42dcf66da638fb86aa4b81e Mon Sep 17 00:00:00 2001 From: Timothy J Fontaine Date: Tue, 29 Oct 2013 16:46:15 -0700 Subject: fs_event_wrap: update to new libuv api --- src/fs_event_wrap.cc | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/src/fs_event_wrap.cc b/src/fs_event_wrap.cc index dad930ae0..4941ded07 100644 --- a/src/fs_event_wrap.cc +++ b/src/fs_event_wrap.cc @@ -108,17 +108,21 @@ void FSEventWrap::Start(const FunctionCallbackInfo& args) { String::Utf8Value path(args[0]); - int err = uv_fs_event_init(wrap->env()->event_loop(), - &wrap->handle_, - *path, - OnEvent, - 0); + int err = uv_fs_event_init(wrap->env()->event_loop(), &wrap->handle_); + if (err == 0) { - // Check for persistent argument - if (!args[1]->IsTrue()) { - uv_unref(reinterpret_cast(&wrap->handle_)); - } wrap->initialized_ = true; + + err = uv_fs_event_start(&wrap->handle_, OnEvent, *path, 0); + + if (err == 0) { + // Check for persistent argument + if (!args[1]->IsTrue()) { + uv_unref(reinterpret_cast(&wrap->handle_)); + } + } else { + FSEventWrap::Close(args); + } } args.GetReturnValue().Set(err); -- cgit v1.2.1