Codebase list golang-github-nightlyone-lockfile / upstream/1.0.0+git20211104.1.bf01bef lockfile_unix.go
upstream/1.0.0+git20211104.1.bf01bef

Tree @upstream/1.0.0+git20211104.1.bf01bef (Download .tar.gz)

lockfile_unix.go @upstream/1.0.0+git20211104.1.bf01befraw · history · blame

// +build darwin dragonfly freebsd linux nacl netbsd openbsd solaris aix

package lockfile

import (
	"os"
	"syscall"
)

func isRunning(pid int) (bool, error) {
	proc, err := os.FindProcess(pid)
	if err != nil {
		return false, err
	}

	if err := proc.Signal(syscall.Signal(0)); err != nil {
		return false, nil
	}

	return true, nil
}