Skip to content

Commit

Permalink
fs_event_wrap: update to new libuv api
Browse files Browse the repository at this point in the history
  • Loading branch information
tjfontaine committed Oct 29, 2013
1 parent a35a212 commit 74a664b
Showing 1 changed file with 13 additions and 9 deletions.
22 changes: 13 additions & 9 deletions src/fs_event_wrap.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 74a664b

Please sign in to comment.