Added exit code
This commit is contained in:
parent
ce4d829184
commit
2282560e7a
@ -110,5 +110,10 @@ func main() {
|
||||
Stdout: os.Stdout,
|
||||
Stderr: os.Stderr,
|
||||
}
|
||||
cmd.Run()
|
||||
err = cmd.Run()
|
||||
if err != nil {
|
||||
if exitError, ok := err.(*exec.ExitError); ok {
|
||||
exitError.ExitCode()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -13,15 +13,6 @@ import (
|
||||
"strings"
|
||||
)
|
||||
|
||||
func (*Version) latestMajorVersion() {
|
||||
}
|
||||
|
||||
func (*Version) latestMinorVersion() {
|
||||
}
|
||||
|
||||
func (*Version) latestPatchVersion() {
|
||||
}
|
||||
|
||||
type Version struct {
|
||||
Version SemVersion
|
||||
availableVersions []SemVersion
|
||||
@ -36,7 +27,6 @@ const (
|
||||
|
||||
//getLatestMajorRelease() returns the latest major release from Version
|
||||
func (v *Version) getLatestMajorRelease() {
|
||||
//todo clean up
|
||||
for _, release := range v.availableVersions {
|
||||
if release.majorVersion == v.Version.majorVersion &&
|
||||
release.minorVersion == v.Version.minorVersion &&
|
||||
@ -118,10 +108,6 @@ func (v *Version) InstallTerraformVersion() error {
|
||||
versionedFileName := homeDir + versionedTerraformFolder + "/" + terraformPrefix + v.Version.ToString()
|
||||
versionedFile, err := os.OpenFile(versionedFileName, os.O_WRONLY, 0755)
|
||||
if os.IsNotExist(err) {
|
||||
//_, err = os.Create(versionedFileName)
|
||||
//if err != nil {
|
||||
// return err
|
||||
//}
|
||||
versionedFile, err = os.OpenFile(versionedFileName, os.O_RDWR|os.O_CREATE|os.O_TRUNC, 0755)
|
||||
if err != nil {
|
||||
return err
|
||||
|
@ -138,7 +138,7 @@ func TestIsVersionGreater(t *testing.T) {
|
||||
|
||||
func TestGetVersionList(t *testing.T) {
|
||||
//todo write test for this
|
||||
//response, _ := getVersionList()
|
||||
//response, _ := GetVersionList()
|
||||
//for _, Version := range response {
|
||||
// t.Errorf("%v", Version)
|
||||
//}
|
||||
|
Loading…
Reference in New Issue
Block a user