This commit is contained in:
Liang Ding 2023-01-08 23:16:14 +08:00
parent 5bc1367b1c
commit 5bfa47d40c
No known key found for this signature in database
GPG key ID: 136F30F901A2231D

View file

@ -136,10 +136,13 @@ func getWorkspaces(c *gin.Context) {
var workspaces []*Workspace
for _, p := range workspacePaths {
closed := true
if flock.New(filepath.Join(p, ".lock")).Locked() {
closed = false
closed := false
f := flock.New(filepath.Join(p, ".lock"))
ok, _ := f.TryLock()
if ok {
closed = true
}
f.Unlock()
workspaces = append(workspaces, &Workspace{Path: p, Closed: closed})
}