Skip to content

Commit

Permalink
Ensure directory for binary exists
Browse files Browse the repository at this point in the history
  • Loading branch information
judahrand committed Oct 28, 2021
1 parent 13e1af7 commit 165f839
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions v2/component/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"fmt"
"io"
"os"
"path/filepath"
)

// CopyThisBinary copies the running binary into destination path.
Expand All @@ -23,6 +24,7 @@ func CopyThisBinary(destination string) (err error) {
return err
}
defer src.Close()
os.MkdirAll(filepath.Dir(destination), 0o555) // 0o555 -> readable and executable by all
dst, err := os.OpenFile(destination, os.O_RDWR|os.O_CREATE|os.O_TRUNC, 0o555) // 0o555 -> readable and executable by all
if err != nil {
return err
Expand Down

0 comments on commit 165f839

Please sign in to comment.