sk-matrix-project/app/wails/pkg/pid/pid.go

25 lines
283 B
Go

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,
}
}