fix(cmd/run): fixed a problem that did not run correctly on windows (#1153)

* fix(cmd/run): fixed a problem that did not run correctly on windows
pull/1154/head
包子 4 years ago committed by GitHub
parent 1ef817507a
commit e9969bc655
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 8
      cmd/kratos/internal/run/run.go

@ -50,6 +50,9 @@ func Run(cmd *cobra.Command, args []string) {
Options: cmdPath,
}
survey.AskOne(prompt, &dir)
if dir == "" {
return
}
dir = path.Join(cmdDir, dir)
}
}
@ -82,7 +85,7 @@ func findCMD(base string) (string, []string, error) {
cmdPath = append(cmdPath, path.Join("cmd", fileInfo.Name()))
}
}
cmdDir, _ = path.Split(walkPath)
cmdDir = filepath.Join(walkPath, "..")
return nil
}
return nil
@ -90,7 +93,6 @@ func findCMD(base string) (string, []string, error) {
return cmdDir, cmdPath, err
}
for i := 0; i < 5; i++ {
base = path.Clean(base)
cmdDir, res, err := next(base)
if err != nil {
return "", nil, err
@ -98,7 +100,7 @@ func findCMD(base string) (string, []string, error) {
if len(res) > 0 {
return cmdDir, res, nil
}
base, _ = path.Split(base)
base = filepath.Join(base, "..")
}
return "", []string{base}, nil
}

Loading…
Cancel
Save