add path contains space prompt and chore

This commit is contained in:
josc146
2023-06-02 23:35:33 +08:00
parent 2b10ccd507
commit 1036852924
4 changed files with 16 additions and 10 deletions

View File

@@ -28,11 +28,11 @@ func Cmd(args ...string) (string, error) {
return "", err
}
path, err := filepath.Abs(args[0])
if err != nil {
return "", err
for _, arg := range args {
if strings.Contains(arg, " ") && strings.Contains(cmdHelper, " ") {
return "", errors.New("path contains space") // golang bug https://github.com/golang/go/issues/17149#issuecomment-473976818
}
}
args[0] = path
cmd := exec.Command(cmdHelper, args...)
out, err := cmd.CombinedOutput()