Gregory Ballantine
24f9b2b779
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
23 lines
384 B
Go
23 lines
384 B
Go
package util
|
|
|
|
import (
|
|
"os/exec"
|
|
"path"
|
|
"strings"
|
|
)
|
|
|
|
func FilenameWithoutExtension(filename string) string {
|
|
return strings.TrimSuffix(filename, path.Ext(filename))
|
|
}
|
|
|
|
func IsFileLocked(filepath string) bool {
|
|
cmd := exec.Command("/usr/bin/lsof", filepath)
|
|
stdout, _ := cmd.Output()
|
|
|
|
if strings.Contains(string(stdout), filepath) {
|
|
return true
|
|
}
|
|
|
|
return false
|
|
}
|