Skip to content

Commit

Permalink
Reference legacy product for default executable name in Unzip and err…
Browse files Browse the repository at this point in the history
…or when passing too many args

Issue #315

Co-authored-by: George L. Yermulnik <yz@yz.kiev.ua>
  • Loading branch information
MatthewJohn and yermulnik committed May 28, 2024
1 parent 269ff35 commit 513ff89
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions lib/files.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,12 @@ func Unzip(src string, dest string, fileToUnzipSlice ...string) ([]string, error
logger.Debugf("Unzipping file %q", src)

// Handle old signature of method, where fileToUnzip did not exist
fileToUnzip := "terraform"
if len(fileToUnzipSlice) > 0 {
legacyProduct := getLegacyProduct()
fileToUnzip := legacyProduct.GetExecutableName()
if len(fileToUnzipSlice) == 1 {
fileToUnzip = fileToUnzipSlice[0]
} else if len(fileToUnzipSlice) > 1 {
logger.Fatal("Too many args passed to Unzip")
}

var filenames []string
Expand Down

0 comments on commit 513ff89

Please sign in to comment.