|
|
@ -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); |
|
|
|