summary refs log tree commit diff stats
path: root/lib/posix/inotify.nim
diff options
context:
space:
mode:
authorJuan Carlos <juancarlospaco@gmail.com>2020-04-01 14:39:58 -0300
committerGitHub <noreply@github.com>2020-04-01 19:39:58 +0200
commit48169847265e13d3b12d670230ad6d33a9d384cc (patch)
tree8028b0bea953b5cecefb6ba4353546b529c19bdd /lib/posix/inotify.nim
parent484548c784f69cadc1f6480a24e99183a0e6a930 (diff)
downloadNim-48169847265e13d3b12d670230ad6d33a9d384cc.tar.gz
Documentation, add more examples (#13825)
Diffstat (limited to 'lib/posix/inotify.nim')
-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
08 11:19:45 +0300 documented trackDirty' href='/ahoang/Nim/commit/doc/advopt.txt?h=devel&id=97eb4bd0ff5792ebd1cb958a726127af1129ce7b'>97eb4bd0f ^
f8dd74a07 ^
674c05f42 ^
c617479c6 ^
674c05f42 ^
091c1b307 ^
1dfea2a36 ^



47886978c ^
405b86068
f8dd74a07 ^

302025755 ^
3b7ef2288 ^



f8dd74a07 ^
c617479c6 ^

15440ec74 ^
538b06a12 ^

196ef92c8 ^



405b86068



3ea644690 ^
6bab7a5bd ^

c617479c6 ^



196ef92c8 ^
3ea644690 ^
3d4084208 ^
3e25d5f24 ^

3b7ef2288 ^
d0edb1826 ^

407515993 ^
5e5e4abfe ^
6023e994f ^
c25ffbf26 ^
1d14cb1ad ^
196ef92c8 ^
c617479c6 ^
fc9fdc2b9 ^

4ee9816a7 ^

76235348f ^
405b86068
cd2c6128d ^

1dc362dcd ^
5893a9195 ^




196ef92c8 ^

053309e60 ^
3ea644690 ^
367abca38 ^

4b7de4dc5 ^
8b2a9401a ^
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94