File tree Expand file tree Collapse file tree 1 file changed +3
-3
lines changed
agent/agentcontainers/watcher Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Original file line number Diff line number Diff line change 5
5
"sync"
6
6
7
7
"github.com/fsnotify/fsnotify"
8
- "golang.org/x/xerrors"
9
8
)
10
9
11
10
// NewNoop creates a new watcher that does nothing.
@@ -27,20 +26,21 @@ func (*noopWatcher) Remove(string) error {
27
26
return nil
28
27
}
29
28
29
+ // Next blocks until the context is canceled or the watcher is closed.
30
30
func (n * noopWatcher ) Next (ctx context.Context ) (* fsnotify.Event , error ) {
31
31
select {
32
32
case <- ctx .Done ():
33
33
return nil , ctx .Err ()
34
34
case <- n .done :
35
- return nil , xerrors . New ( "watcher closed" )
35
+ return nil , ErrWatcherClosed
36
36
}
37
37
}
38
38
39
39
func (n * noopWatcher ) Close () error {
40
40
n .mu .Lock ()
41
41
defer n .mu .Unlock ()
42
42
if n .closed {
43
- return nil
43
+ return ErrWatcherClosed
44
44
}
45
45
n .closed = true
46
46
close (n .done )
You can’t perform that action at this time.
0 commit comments