diff options
Diffstat (limited to 'vendor/github.com/ncruces/go-sqlite3/internal/dotlk/dotlk_other.go')
-rw-r--r-- | vendor/github.com/ncruces/go-sqlite3/internal/dotlk/dotlk_other.go | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/vendor/github.com/ncruces/go-sqlite3/internal/dotlk/dotlk_other.go b/vendor/github.com/ncruces/go-sqlite3/internal/dotlk/dotlk_other.go new file mode 100644 index 000000000..5399a5f8a --- /dev/null +++ b/vendor/github.com/ncruces/go-sqlite3/internal/dotlk/dotlk_other.go @@ -0,0 +1,13 @@ +//go:build !unix + +package dotlk + +import "os" + +// TryLock returns nil if it acquired the lock, +// fs.ErrExist if another process has the lock. +func TryLock(name string) error { + f, err := os.OpenFile(name, os.O_RDWR|os.O_CREATE|os.O_EXCL, 0666) + f.Close() + return err +} |