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