don't do any logging in realMain.

We should write to os.Stderr explicitly, like we already do.

don't warn if config lookup fails in main
This commit is contained in:
Matthew Hooker 2017-06-21 14:50:21 -07:00
parent 5da9b3de61
commit 0af5b4d1ad
No known key found for this signature in database
GPG Key ID: 7B5F933D9CE8C6A1
1 changed files with 4 additions and 7 deletions

11
main.go
View File

@ -53,6 +53,9 @@ func realMain() int {
logWriter = ioutil.Discard
}
// Disable logging here
log.SetOutput(ioutil.Discard)
// We always send logs to a temporary file that we use in case
// there is a panic. Otherwise, we delete it.
logTempFile, err := ioutil.TempFile("", "packer-log")
@ -74,13 +77,7 @@ func realMain() int {
go copyOutput(outR, doneCh)
// Enable checkpoint for panic reporting
config, err := loadConfig()
if err != nil {
fmt.Fprintf(os.Stderr, "Couldn't load config: %s", err)
return 1
}
if !config.DisableCheckpoint {
if config, _ := loadConfig(); config != nil && !config.DisableCheckpoint {
packer.CheckpointReporter.Enable(config.DisableCheckpointSignature)
}