|
|
|
|
@ -8,6 +8,7 @@ import (
|
|
|
|
|
"os"
|
|
|
|
|
"sync"
|
|
|
|
|
|
|
|
|
|
"github.com/hashicorp/terraform/helper/logging"
|
|
|
|
|
"github.com/hashicorp/terraform/plugin"
|
|
|
|
|
"github.com/mitchellh/cli"
|
|
|
|
|
"github.com/mitchellh/panicwrap"
|
|
|
|
|
@ -23,14 +24,11 @@ func realMain() int {
|
|
|
|
|
|
|
|
|
|
if !panicwrap.Wrapped(&wrapConfig) {
|
|
|
|
|
// Determine where logs should go in general (requested by the user)
|
|
|
|
|
logWriter, err := logOutput()
|
|
|
|
|
logWriter, err := logging.LogOutput()
|
|
|
|
|
if err != nil {
|
|
|
|
|
fmt.Fprintf(os.Stderr, "Couldn't setup log output: %s", err)
|
|
|
|
|
return 1
|
|
|
|
|
}
|
|
|
|
|
if logWriter == nil {
|
|
|
|
|
logWriter = ioutil.Discard
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// We always send logs to a temporary file that we use in case
|
|
|
|
|
// there is a panic. Otherwise, we delete it.
|
|
|
|
|
@ -42,10 +40,6 @@ func realMain() int {
|
|
|
|
|
defer os.Remove(logTempFile.Name())
|
|
|
|
|
defer logTempFile.Close()
|
|
|
|
|
|
|
|
|
|
// Tell the logger to log to this file
|
|
|
|
|
os.Setenv(EnvLog, "")
|
|
|
|
|
os.Setenv(EnvLogFile, "")
|
|
|
|
|
|
|
|
|
|
// Setup the prefixed readers that send data properly to
|
|
|
|
|
// stdout/stderr.
|
|
|
|
|
doneCh := make(chan struct{})
|
|
|
|
|
|