Skip to content

Commit

Permalink
Fix/windows cli issue (#394)
Browse files Browse the repository at this point in the history
* Close ZipReader properly

* Do not remove bin file on extraction
  • Loading branch information
mukundansundar authored Jul 14, 2020
1 parent 89b7516 commit 5f9cb75
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 8 deletions.
2 changes: 1 addition & 1 deletion pkg/standalone/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ func binaryFilePath(binaryFilePrefix, installLocation string) string {
destDir := binaryInstallationPath(installLocation)
binaryPath := path_filepath.Join(destDir, binaryFilePrefix)
if runtime.GOOS == daprWindowsOS {
binaryPath = path_filepath.Join(binaryPath, ".exe")
binaryPath += ".exe"
}
return binaryPath
}
Expand Down
8 changes: 1 addition & 7 deletions pkg/standalone/standalone.go
Original file line number Diff line number Diff line change
Expand Up @@ -520,13 +520,6 @@ func installBinary(wg *sync.WaitGroup, errorChan chan<- error, dir, version, bin
return
}

err = os.Remove(extractedFilePath)

if err != nil {
errorChan <- fmt.Errorf("failed to remove extracted binary: %s", err)
return
}

err = makeExecutable(binaryPath)
if err != nil {
errorChan <- fmt.Errorf("error making %s binary executable: %s", binaryFilePrefix, err)
Expand Down Expand Up @@ -597,6 +590,7 @@ func unzip(filepath, targetDir string) (string, error) {
if err != nil {
return "", err
}
defer zipReader.Close()

if len(zipReader.Reader.File) > 0 {
file := zipReader.Reader.File[0]
Expand Down

0 comments on commit 5f9cb75

Please sign in to comment.