diff --git a/model/command_config.go b/model/command_config.go index 4b6d9e5..41f82d6 100644 --- a/model/command_config.go +++ b/model/command_config.go @@ -261,10 +261,10 @@ func (c *CommandConfig) InitGoPaths() { } } + utils.Logger.Info("Source root", "path", c.SrcRoot, "cwd", workingDir, "gopath", c.GoPath, "bestpath",bestpath) if len(c.SrcRoot) == 0 && len(bestpath) > 0 { c.SrcRoot = bestpath } - utils.Logger.Info("Source root", "path", c.SrcRoot, "cwd", workingDir, "gopath", c.GoPath) // If source root is empty and this isn't a version then skip it if len(c.SrcRoot) == 0 { diff --git a/revel/new.go b/revel/new.go index ed22bda..abe299d 100644 --- a/revel/new.go +++ b/revel/new.go @@ -16,6 +16,9 @@ import ( "github.com/revel/cmd/model" "github.com/revel/cmd/utils" "net/url" + "github.com/kr/pty" + "io" + "bytes" ) var cmdNew = &Command{ @@ -114,10 +117,16 @@ func newApp(c *model.CommandConfig) (err error) { getCmd := exec.Command("dep", "ensure", "-v") utils.CmdInit(getCmd, c.AppPath) - utils.Logger.Info("Exec:", "args", getCmd.Args) - getOutput, err := getCmd.CombinedOutput() + f, err := pty.Start(getCmd); + stdout := new(bytes.Buffer) + io.Copy(io.MultiWriter(stdout, os.Stdout), f) + if err = getCmd.Wait(); err != nil { + + } + utils.Logger.Info("Exec:", "args", getCmd.Args, "env", getCmd.Env, "workingdir",getCmd.Dir) + // getOutput, err := getCmd.CombinedOutput() if err != nil { - return utils.NewBuildIfError(err, string(getOutput)) + return utils.NewBuildIfError(err, stdout.String()) } } diff --git a/utils/command.go b/utils/command.go index 7468fc1..4a36592 100644 --- a/utils/command.go +++ b/utils/command.go @@ -5,13 +5,24 @@ import ( "os" "os/exec" "strings" + "bytes" + "path/filepath" ) // Initialize the command based on the GO environment func CmdInit(c *exec.Cmd, basePath string) { c.Dir = basePath + // Dep does not like paths that are not real, convert all paths in go to real paths + realPath := &bytes.Buffer{} + for _, p := range filepath.SplitList(build.Default.GOPATH) { + rp,_ := filepath.EvalSymlinks(p) + if realPath.Len() > 0 { + realPath.WriteString(string(filepath.ListSeparator)) + } + realPath.WriteString(rp) + } // Go 1.8 fails if we do not include the GOROOT - c.Env = []string{"GOPATH=" + build.Default.GOPATH, "GOROOT="+ os.Getenv("GOROOT")} + c.Env = []string{"GOPATH=" + realPath.String(), "GOROOT="+ os.Getenv("GOROOT")} // Fetch the rest of the env variables for _, e := range os.Environ() { pair := strings.Split(e, "=")