summary refs log tree commit diff stats
path: root/lib/posix
diff options
context:
space:
mode:
Diffstat (limited to 'lib/posix')
-rw-r--r--lib/posix/inotify.nim10
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/posix/inotify.nim b/lib/posix/inotify.nim
index f88e48a2d..9728b749b 100644
--- a/lib/posix/inotify.nim
+++ b/lib/posix/inotify.nim
@@ -70,3 +70,13 @@ proc inotify_add_watch*(fd: cint; name: cstring; mask: uint32): cint{.
 # Remove the watch specified by WD from the inotify instance FD.
 proc inotify_rm_watch*(fd: cint; wd: cint): cint{.cdecl,
     importc: "inotify_rm_watch", header: "<sys/inotify.h>".}
+
+
+runnableExamples:
+  when defined(linux):
+    block:
+      let inoty: cint = inotify_init()                 ## Create 1 Inotify.
+      doAssert inoty >= 0                              ## Check for errors.
+      let watchdoge: cint = inotify_add_watch(inoty, ".", IN_ALL_EVENTS) ## Add directory to watchdog.
+      doAssert watchdoge >= 0                          ## Check for errors.
+      doAssert inotify_rm_watch(inoty, watchdoge) >= 0 ## Remove directory from the watchdog