mirror of
https://github.com/crawlab-team/crawlab.git
synced 2026-01-22 17:31:03 +01:00
feat: added modules
This commit is contained in:
24
core/sys_exec/sys_exec_linux.go
Normal file
24
core/sys_exec/sys_exec_linux.go
Normal file
@@ -0,0 +1,24 @@
|
||||
//go:build linux
|
||||
// +build linux
|
||||
|
||||
package sys_exec
|
||||
|
||||
import (
|
||||
"os/exec"
|
||||
"syscall"
|
||||
)
|
||||
|
||||
func BuildCmd(cmdStr string) *exec.Cmd {
|
||||
return exec.Command("sh", "-c", cmdStr)
|
||||
}
|
||||
|
||||
func SetPgid(cmd *exec.Cmd) {
|
||||
if cmd == nil {
|
||||
return
|
||||
}
|
||||
if cmd.SysProcAttr == nil {
|
||||
cmd.SysProcAttr = &syscall.SysProcAttr{Setpgid: true}
|
||||
} else {
|
||||
cmd.SysProcAttr.Setpgid = true
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user