2016-11-21 19:35:18 +01:00
|
|
|
// +build !windows
|
|
|
|
|
|
|
|
package wrappedstreams
|
|
|
|
|
|
|
|
import (
|
|
|
|
"os"
|
2020-04-04 21:46:19 +02:00
|
|
|
"sync"
|
2016-11-21 19:35:18 +01:00
|
|
|
)
|
|
|
|
|
2020-04-04 21:46:19 +02:00
|
|
|
var initOnce sync.Once
|
|
|
|
|
2016-11-21 19:35:18 +01:00
|
|
|
func initPlatform() {
|
2020-04-04 21:46:19 +02:00
|
|
|
// These must be initialized lazily, once it's been determined that this is
|
|
|
|
// a wrapped process.
|
|
|
|
initOnce.Do(func() {
|
|
|
|
// The standard streams are passed in via extra file descriptors.
|
|
|
|
wrappedStdin = os.NewFile(uintptr(3), "stdin")
|
|
|
|
wrappedStdout = os.NewFile(uintptr(4), "stdout")
|
|
|
|
wrappedStderr = os.NewFile(uintptr(5), "stderr")
|
|
|
|
})
|
2016-11-21 19:35:18 +01:00
|
|
|
}
|