Skip to content

Commit

Permalink
Fix error output when packages fail to install
Browse files Browse the repository at this point in the history
  • Loading branch information
dshafik committed Feb 5, 2018
1 parent f17b94d commit b2f7a8b
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions command_install.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,10 @@ func cmdInstall(c *cli.Context) error {
oldCmds := getCommands()

for _, repo := range c.Args() {
installPackage(repo, c.Bool("force"))
err := installPackage(repo, c.Bool("force"))
if err != nil {
return err
}
}

packageListDiff(oldCmds)
Expand All @@ -44,7 +47,7 @@ func installPackage(repo string, forceBinary bool) error {
dirName := strings.TrimSuffix(filepath.Base(repo), ".git")
packageDir := filepath.Join(srcPath, dirName)
if _, err := os.Stat(packageDir); err == nil {
status.FinalMSG = "... [" + color.RedString("FAIL") + "]"
status.FinalMSG = status.Prefix + "... [" + color.RedString("FAIL") + "]\n"
status.Stop()

return cli.NewExitError(color.RedString("Package directory already exists (%s)", packageDir), 1)
Expand All @@ -58,7 +61,7 @@ func installPackage(repo string, forceBinary bool) error {
if err != nil {
os.RemoveAll(packageDir)

status.FinalMSG = "... [" + color.RedString("FAIL") + "]"
status.FinalMSG = status.Prefix + "... [" + color.RedString("FAIL") + "]\n"
status.Stop()

return cli.NewExitError(color.RedString("Unable to clone repository: "+err.Error()), 1)
Expand Down

0 comments on commit b2f7a8b

Please sign in to comment.