Branch: Tag:

2015-10-21

2015-10-21 08:34:17 by Martin Karlgren <marty@roxen.com>

Filesystem.Monitor: Let inotify monitors fallback to poll if file doesn't exist.

979: Inside #if undefined(INHIBIT_INOTIFY_MONITOR)
   }       Stdio.Stat st = file_stat (path, 1); +  mixed err;    if (st && st->isdir) {    // Note: We only want to add watchers on directories. File    // notifications will take place on the directory watch
986: Inside #if undefined(INHIBIT_INOTIFY_MONITOR)
   // on individual files is handled in the inotify_event    // callback.    -  if (mixed err = catch { +  if (err = catch {    int new_wd = instance->add_watch(path,    System.Inotify.IN_MOVED_FROM |    System.Inotify.IN_UNMOUNT |
1021: Inside #if undefined(INHIBIT_INOTIFY_MONITOR)
   }    }    -  return; +  if (st && !err) +  return; // Return early if setup was successful, i.e. avoid +  // registering a polling monitor.      #endif /* !INHIBIT_INOTIFY_MONITOR */    MON_WERR("Registering %O for polling.\n", path);