408 {
410 std::unique_ptr<uv_fs_event_t> &uv_handle = fsWatch.uv_handle_;
411 const uv_status initStatus = uv_fs_event_init(loop.uvloop(), uv_handle.get());
412 if (initStatus != 0) {
413 throw UvcoException{
414 initStatus,
415 "uv_fs_event_init returned error while initializing FsWatch"};
416 }
417 const std::string path_str(path);
418 const int startStatus = uv_fs_event_start(uv_handle.get(),
onFsWatcherEvent,
419 path_str.c_str(), flags);
420 if (startStatus != 0) {
421 uv_fs_event_stop(uv_handle.get());
422
424 throw UvcoException{
425 startStatus, "uv_fs_event_start returned error while starting FsWatch"};
426 }
427 co_return fsWatch;
428}
FsWatch(const FsWatch &)=delete
static void onFsWatcherEvent(uv_fs_event_t *handle, const char *path, int events, uv_status status)
Definition fs.cc:455
int uv_status
Result of a libuv operation, an errno error code.
Definition internal_utils.h:22