Skip to content

Commit

Permalink
fix: git lookpath
Browse files Browse the repository at this point in the history
  • Loading branch information
soasurs committed Aug 6, 2020
1 parent c7f87e8 commit c7f08de
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions lean/main_test.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package main

import (
"errors"
"fmt"
"io/ioutil"
"os"
Expand All @@ -17,23 +18,28 @@ func TestMain(m *testing.M) {

dir, err := ioutil.TempDir("", "*")
if err != nil {
fmt.Fprintln(os.Stderr, err)
fmt.Println(err)
panic(err)
}

if err := os.Chdir(dir); err != nil {
fmt.Fprintln(os.Stderr, err)
fmt.Println(err)
panic(err)
}

if err := exec.Command("git", "clone", repoURL, "lean-cli-deployment").Run(); err != nil {
fmt.Fprintln(os.Stderr, err)
gitExec, err := exec.LookPath("git")
if err != nil {
fmt.Println("can't find git executable file")
panic(errors.New("can't find git executable file"))
}
if err := exec.Command(gitExec, "clone", repoURL, "lean-cli-deployment").Run(); err != nil {
fmt.Println(err)
panic(err)
}

gitDir := filepath.Join(dir, "lean-cli-deployment")
if err := os.Chdir(gitDir); err != nil {
fmt.Fprintln(os.Stderr, err)
fmt.Println(err)
panic(err)
}

Expand Down

0 comments on commit c7f08de

Please sign in to comment.