node build fixed
This commit is contained in:
30
seanime-2.9.10/internal/util/mem.go
Normal file
30
seanime-2.9.10/internal/util/mem.go
Normal file
@@ -0,0 +1,30 @@
|
||||
package util
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os/exec"
|
||||
"runtime"
|
||||
"strings"
|
||||
)
|
||||
|
||||
func GetMemAddrStr(v interface{}) string {
|
||||
return fmt.Sprintf("%p", v)
|
||||
}
|
||||
|
||||
func ProgramIsRunning(name string) bool {
|
||||
var cmd *exec.Cmd
|
||||
switch runtime.GOOS {
|
||||
case "windows":
|
||||
cmd = NewCmd("tasklist")
|
||||
case "linux":
|
||||
cmd = NewCmd("pgrep", name)
|
||||
case "darwin":
|
||||
cmd = NewCmd("pgrep", name)
|
||||
default:
|
||||
return false
|
||||
}
|
||||
|
||||
output, _ := cmd.Output()
|
||||
|
||||
return strings.Contains(string(output), name)
|
||||
}
|
||||
Reference in New Issue
Block a user