diff options
author | Timothy J Fontaine <tjfontaine@gmail.com> | 2013-10-29 16:46:15 -0700 |
---|---|---|
committer | Timothy J Fontaine <tjfontaine@gmail.com> | 2013-10-29 16:46:15 -0700 |
commit | 74a664b22f2caf3ea42dcf66da638fb86aa4b81e (patch) | |
tree | c83f068cb0b67ea3ad985fc6702a1b6b53a76ce3 | |
parent | a35a212f258812bd178f7f002660a0ddc0bf10b2 (diff) | |
download | node-74a664b22f2caf3ea42dcf66da638fb86aa4b81e.tar.gz |
fs_event_wrap: update to new libuv api
-rw-r--r-- | src/fs_event_wrap.cc | 22 |
1 files 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<Value>& 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<uv_handle_t*>(&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<uv_handle_t*>(&wrap->handle_)); + } + } else { + FSEventWrap::Close(args); + } } args.GetReturnValue().Set(err); |