mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-16 22:50:13 +01:00
This commit is contained in:
parent
fbfbe1b0ce
commit
1715b150a2
3 changed files with 57 additions and 50 deletions
|
|
@ -446,10 +446,16 @@ func GetDataAssetsAbsPath() (ret string) {
|
|||
|
||||
func tryLockWorkspace() {
|
||||
WorkspaceLock = flock.New(filepath.Join(WorkspaceDir, ".lock"))
|
||||
if err := WorkspaceLock.Lock(); nil != err {
|
||||
logging.LogErrorf("lock workspace [%s] failed: %s", WorkspaceDir, err)
|
||||
os.Exit(ExitCodeWorkspaceLocked)
|
||||
ok, err := WorkspaceLock.TryLock()
|
||||
if ok {
|
||||
return
|
||||
}
|
||||
if nil != err {
|
||||
logging.LogErrorf("lock workspace [%s] failed: %s", WorkspaceDir, err)
|
||||
} else {
|
||||
logging.LogErrorf("lock workspace [%s] failed", WorkspaceDir)
|
||||
}
|
||||
os.Exit(ExitCodeWorkspaceLocked)
|
||||
}
|
||||
|
||||
func UnlockWorkspace() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue