Skip to content

Commit

Permalink
Merge pull request #13 from yuuki/fix_linux_rename
Browse files Browse the repository at this point in the history
Fix rename error that occurs if the target is a naked binary
  • Loading branch information
Songmu authored Jun 13, 2018
2 parents 70be685 + 6e7ceb6 commit 190bc21
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions ghg.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,9 @@ func (gh *ghg) install(url string) error {
tmpdir := filepath.Dir(archivePath)
defer os.RemoveAll(tmpdir)

bin := gh.getBinDir()
os.MkdirAll(bin, 0755)

if !archiveReg.MatchString(url) {
_, repo, _, _ := getOwnerRepoAndTag(gh.target)
name := lcs(repo, filepath.Base(archivePath))
Expand All @@ -129,9 +132,6 @@ func (gh *ghg) install(url string) error {
return errors.Wrap(err, "failed to extract")
}

bin := gh.getBinDir()
os.MkdirAll(bin, 0755)

err = gh.pickupExecutable(workDir)
if err != nil {
return errors.Wrap(err, "failed to pickup")
Expand Down

0 comments on commit 190bc21

Please sign in to comment.