github.com/iaas-resource-provision/iaas-rpc@v1.0.7-0.20211021023331-ed21f798c408/internal/helper/wrappedstreams/streams_other.go (about)

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