github.com/jaredpalmer/terraform@v1.1.0-alpha20210908.0.20210911170307-88705c943a03/internal/helper/wrappedstreams/streams_other.go (about)

     1  //go:build !windows
     2  // +build !windows
     3  
     4  package wrappedstreams
     5  
     6  import (
     7  	"os"
     8  	"sync"
     9  )
    10  
    11  var initOnce sync.Once
    12  
    13  func initPlatform() {
    14  	// These must be initialized lazily, once it's been determined that this is
    15  	// a wrapped process.
    16  	initOnce.Do(func() {
    17  		// The standard streams are passed in via extra file descriptors.
    18  		wrappedStdin = os.NewFile(uintptr(3), "stdin")
    19  		wrappedStdout = os.NewFile(uintptr(4), "stdout")
    20  		wrappedStderr = os.NewFile(uintptr(5), "stderr")
    21  	})
    22  }