fix: unable to sync files and save data issues

This commit is contained in:
Marvin Zhang
2024-06-25 14:58:54 +08:00
parent 23e3c90826
commit bea392485b
12 changed files with 113 additions and 31 deletions

View File

@@ -4,12 +4,18 @@
package sys_exec
import (
"errors"
"os/exec"
"strings"
"syscall"
)
func BuildCmd(cmdStr string) *exec.Cmd {
return exec.Command("sh", "-c", cmdStr)
func BuildCmd(cmdStr string) (cmd *exec.Cmd, err error) {
if cmdStr == "" {
return nil, errors.New("command string is empty")
}
args := strings.Split(cmdStr, " ")
return exec.Command(args[0], args[1:]...), nil
}
func SetPgid(cmd *exec.Cmd) {