summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTimothy J Fontaine <tjfontaine@gmail.com>2013-10-29 16:46:15 -0700
committerTimothy J Fontaine <tjfontaine@gmail.com>2013-10-29 16:46:15 -0700
commit74a664b22f2caf3ea42dcf66da638fb86aa4b81e (patch)
treec83f068cb0b67ea3ad985fc6702a1b6b53a76ce3
parenta35a212f258812bd178f7f002660a0ddc0bf10b2 (diff)
downloadnode-74a664b22f2caf3ea42dcf66da638fb86aa4b81e.tar.gz
fs_event_wrap: update to new libuv api
-rw-r--r--src/fs_event_wrap.cc22
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);