vendor: Update github.com/zillode/notify
This commit is contained in:
parent
ece1defb2f
commit
57eb1710e9
|
@ -2,10 +2,52 @@
|
||||||
// Use of this source code is governed by the MIT license that can be
|
// Use of this source code is governed by the MIT license that can be
|
||||||
// found in the LICENSE file.
|
// found in the LICENSE file.
|
||||||
|
|
||||||
// +build !debug
|
|
||||||
|
|
||||||
package notify
|
package notify
|
||||||
|
|
||||||
func dbgprint(...interface{}) {}
|
import (
|
||||||
|
"log"
|
||||||
|
"os"
|
||||||
|
"runtime"
|
||||||
|
"strings"
|
||||||
|
)
|
||||||
|
|
||||||
func dbgprintf(string, ...interface{}) {}
|
var dbgprint func(...interface{})
|
||||||
|
|
||||||
|
var dbgprintf func(string, ...interface{})
|
||||||
|
|
||||||
|
var dbgcallstack func(max int) []string
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
if _, ok := os.LookupEnv("NOTIFY_DEBUG"); ok || debugTag {
|
||||||
|
log.SetOutput(os.Stdout)
|
||||||
|
log.SetFlags(log.Ldate | log.Ltime | log.Lmicroseconds)
|
||||||
|
dbgprint = func(v ...interface{}) {
|
||||||
|
v = append([]interface{}{"[D] "}, v...)
|
||||||
|
log.Println(v...)
|
||||||
|
}
|
||||||
|
dbgprintf = func(format string, v ...interface{}) {
|
||||||
|
format = "[D] " + format
|
||||||
|
log.Printf(format, v...)
|
||||||
|
}
|
||||||
|
dbgcallstack = func(max int) []string {
|
||||||
|
pc, stack := make([]uintptr, max), make([]string, 0, max)
|
||||||
|
runtime.Callers(2, pc)
|
||||||
|
for _, pc := range pc {
|
||||||
|
if f := runtime.FuncForPC(pc); f != nil {
|
||||||
|
fname := f.Name()
|
||||||
|
idx := strings.LastIndex(fname, string(os.PathSeparator))
|
||||||
|
if idx != -1 {
|
||||||
|
stack = append(stack, fname[idx+1:])
|
||||||
|
} else {
|
||||||
|
stack = append(stack, fname)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return stack
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
dbgprint = func(v ...interface{}) {}
|
||||||
|
dbgprintf = func(format string, v ...interface{}) {}
|
||||||
|
dbgcallstack = func(max int) []string { return nil }
|
||||||
|
}
|
||||||
|
|
|
@ -6,38 +6,4 @@
|
||||||
|
|
||||||
package notify
|
package notify
|
||||||
|
|
||||||
import (
|
var debugTag bool = true
|
||||||
"fmt"
|
|
||||||
"os"
|
|
||||||
"runtime"
|
|
||||||
"strings"
|
|
||||||
)
|
|
||||||
|
|
||||||
func dbgprint(v ...interface{}) {
|
|
||||||
fmt.Printf("[D] ")
|
|
||||||
fmt.Print(v...)
|
|
||||||
fmt.Printf("\n\n")
|
|
||||||
}
|
|
||||||
|
|
||||||
func dbgprintf(format string, v ...interface{}) {
|
|
||||||
fmt.Printf("[D] ")
|
|
||||||
fmt.Printf(format, v...)
|
|
||||||
fmt.Printf("\n\n")
|
|
||||||
}
|
|
||||||
|
|
||||||
func dbgcallstack(max int) []string {
|
|
||||||
pc, stack := make([]uintptr, max), make([]string, 0, max)
|
|
||||||
runtime.Callers(2, pc)
|
|
||||||
for _, pc := range pc {
|
|
||||||
if f := runtime.FuncForPC(pc); f != nil {
|
|
||||||
fname := f.Name()
|
|
||||||
idx := strings.LastIndex(fname, string(os.PathSeparator))
|
|
||||||
if idx != -1 {
|
|
||||||
stack = append(stack, fname[idx+1:])
|
|
||||||
} else {
|
|
||||||
stack = append(stack, fname)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return stack
|
|
||||||
}
|
|
||||||
|
|
|
@ -0,0 +1,9 @@
|
||||||
|
// Copyright (c) 2014-2015 The Notify Authors. All rights reserved.
|
||||||
|
// Use of this source code is governed by the MIT license that can be
|
||||||
|
// found in the LICENSE file.
|
||||||
|
|
||||||
|
// +build !debug
|
||||||
|
|
||||||
|
package notify
|
||||||
|
|
||||||
|
var debugTag bool = false
|
|
@ -6,7 +6,6 @@ package notify
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
@ -71,7 +70,11 @@ Traverse:
|
||||||
case errSkip:
|
case errSkip:
|
||||||
continue Traverse
|
continue Traverse
|
||||||
default:
|
default:
|
||||||
return fmt.Errorf("error while traversing %q: %v", nd.Name, err)
|
return &os.PathError{
|
||||||
|
Op: "error while traversing",
|
||||||
|
Path: nd.Name,
|
||||||
|
Err: err,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// TODO(rjeczalik): tolerate open failures - add failed names to
|
// TODO(rjeczalik): tolerate open failures - add failed names to
|
||||||
// AddDirError and notify users which names are not added to the tree.
|
// AddDirError and notify users which names are not added to the tree.
|
||||||
|
|
|
@ -48,7 +48,7 @@ var wg sync.WaitGroup // used to wait until the runloop starts
|
||||||
// started and is ready via the wg. It also serves purpose of a dummy source,
|
// started and is ready via the wg. It also serves purpose of a dummy source,
|
||||||
// thanks to it the runloop does not return as it also has at least one source
|
// thanks to it the runloop does not return as it also has at least one source
|
||||||
// registered.
|
// registered.
|
||||||
var source = C.CFRunLoopSourceCreate(nil, 0, &C.CFRunLoopSourceContext{
|
var source = C.CFRunLoopSourceCreate(refZero, 0, &C.CFRunLoopSourceContext{
|
||||||
perform: (C.CFRunLoopPerformCallBack)(C.gosource),
|
perform: (C.CFRunLoopPerformCallBack)(C.gosource),
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -159,8 +159,8 @@ func (s *stream) Start() error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
wg.Wait()
|
wg.Wait()
|
||||||
p := C.CFStringCreateWithCStringNoCopy(nil, C.CString(s.path), C.kCFStringEncodingUTF8, nil)
|
p := C.CFStringCreateWithCStringNoCopy(refZero, C.CString(s.path), C.kCFStringEncodingUTF8, refZero)
|
||||||
path := C.CFArrayCreate(nil, (*unsafe.Pointer)(unsafe.Pointer(&p)), 1, nil)
|
path := C.CFArrayCreate(refZero, (*unsafe.Pointer)(unsafe.Pointer(&p)), 1, nil)
|
||||||
ctx := C.FSEventStreamContext{}
|
ctx := C.FSEventStreamContext{}
|
||||||
ref := C.EventStreamCreate(&ctx, C.uintptr_t(s.info), path, C.FSEventStreamEventId(atomic.LoadUint64(&since)), latency, flags)
|
ref := C.EventStreamCreate(&ctx, C.uintptr_t(s.info), path, C.FSEventStreamEventId(atomic.LoadUint64(&since)), latency, flags)
|
||||||
if ref == nilstream {
|
if ref == nilstream {
|
||||||
|
|
|
@ -0,0 +1,9 @@
|
||||||
|
// Copyright (c) 2017 The Notify Authors. All rights reserved.
|
||||||
|
// Use of this source code is governed by the MIT license that can be
|
||||||
|
// found in the LICENSE file.
|
||||||
|
|
||||||
|
// +build darwin,!kqueue,go1.10
|
||||||
|
|
||||||
|
package notify
|
||||||
|
|
||||||
|
const refZero = 0
|
|
@ -0,0 +1,14 @@
|
||||||
|
// Copyright (c) 2017 The Notify Authors. All rights reserved.
|
||||||
|
// Use of this source code is governed by the MIT license that can be
|
||||||
|
// found in the LICENSE file.
|
||||||
|
|
||||||
|
// +build darwin,!kqueue,cgo,!go1.10
|
||||||
|
|
||||||
|
package notify
|
||||||
|
|
||||||
|
/*
|
||||||
|
#include <CoreServices/CoreServices.h>
|
||||||
|
*/
|
||||||
|
import "C"
|
||||||
|
|
||||||
|
var refZero = (*C.struct___CFAllocator)(nil)
|
|
@ -449,7 +449,7 @@
|
||||||
"importpath": "github.com/zillode/notify",
|
"importpath": "github.com/zillode/notify",
|
||||||
"repository": "https://github.com/zillode/notify",
|
"repository": "https://github.com/zillode/notify",
|
||||||
"vcs": "git",
|
"vcs": "git",
|
||||||
"revision": "54e3093eb7377fd139c4605f475cc78e83610b9d",
|
"revision": "8fff849a2026ce7a59f67ed9747dd9c7adc8bd0b",
|
||||||
"branch": "master",
|
"branch": "master",
|
||||||
"notests": true
|
"notests": true
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in New Issue