+15
-4
@@ -45,8 +45,8 @@ const (
|
||||
|
||||
var ( // GOOS specific ignore list.
|
||||
ignoreFiles = map[string][]string{
|
||||
"darwin": {".DS_Store"},
|
||||
// "default": []string{""},
|
||||
"darwin": {"*.DS_Store"},
|
||||
"default": {"*.part.minio"},
|
||||
}
|
||||
)
|
||||
|
||||
@@ -66,14 +66,22 @@ func isIgnoredFile(filename string) bool {
|
||||
|
||||
// OS specific ignore list.
|
||||
for _, ignoredFile := range ignoreFiles[runtime.GOOS] {
|
||||
if ignoredFile == matchFile {
|
||||
matched, err := filepath.Match(ignoredFile, matchFile)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
if matched {
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
// Default ignore list for all OSes.
|
||||
for _, ignoredFile := range ignoreFiles["default"] {
|
||||
if ignoredFile == matchFile {
|
||||
matched, err := filepath.Match(ignoredFile, matchFile)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
if matched {
|
||||
return true
|
||||
}
|
||||
}
|
||||
@@ -137,6 +145,9 @@ func (f *fsClient) Watch(params watchParams) (*watchObject, *probe.Error) {
|
||||
if !ok {
|
||||
return
|
||||
}
|
||||
if isIgnoredFile(event.Path()) {
|
||||
continue
|
||||
}
|
||||
var i os.FileInfo
|
||||
if IsPutEvent(event.Event()) {
|
||||
// Look for any writes, send a response to indicate a full copy.
|
||||
|
||||
+4
-1
@@ -168,6 +168,9 @@ func mainWatch(ctx *cli.Context) error {
|
||||
for {
|
||||
select {
|
||||
case <-trapCh:
|
||||
// Signal received we are done.
|
||||
close(wo.done)
|
||||
return
|
||||
case event, ok := <-wo.Events():
|
||||
if !ok {
|
||||
return
|
||||
@@ -178,7 +181,7 @@ func mainWatch(ctx *cli.Context) error {
|
||||
if !ok {
|
||||
return
|
||||
}
|
||||
fatalIf(err, "Cannot watch on events.")
|
||||
errorIf(err, "Cannot watch on events.")
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user