Skip to content

Commit

Permalink
Issue #929: logging: Ensure ~/.crc exists before creating log file (#932
Browse files Browse the repository at this point in the history
)

crc-embedder currently fails if ~/.crc does not exist. This is because
it tries to create a log file before ~/.crc is created. Adding a call to
EnsureBaseDirExists() before trying to create the log file fixes this
issue.

This fixes #929
  • Loading branch information
cfergeau authored and praveenkumar committed Jan 21, 2020
1 parent 7001821 commit 8b35135
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions pkg/crc/logging/logging.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ var (
)

func OpenLogFile() (*os.File, error) {
err := constants.EnsureBaseDirExists()
if err != nil {
return nil, err
}
l, err := os.OpenFile(filepath.Join(constants.LogFilePath), os.O_WRONLY|os.O_APPEND|os.O_CREATE, 0600)
if err != nil {
return nil, err
Expand Down

0 comments on commit 8b35135

Please sign in to comment.