wails-app-dock/pkg/pid/pid.go

25 lines
283 B
Go
Raw Normal View History

2024-02-17 21:45:43 +08:00
package pid
import (
"errors"
"os"
"path/filepath"
)
var (
LockFail = errors.New("进程锁创建失败")
)
type PidLock struct {
file string
lock *os.File
}
func NewPidLock(path string) *PidLock {
absPath, _ := filepath.Abs(path)
return &PidLock{
file: absPath,
}
}