micro/util/io/redirect.go
Vasiliy Tolstov af278bd7d3
All checks were successful
lint / lint (pull_request) Successful in 46s
pr / test (pull_request) Successful in 50s
util/io: add RedirectStderr
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2023-04-24 12:58:05 +03:00

18 lines
213 B
Go

package io
import (
"os"
"sync"
)
var osStderrMu sync.Mutex
var OrigStderr = func() *os.File {
fd, err := dupFD(os.Stderr.Fd())
if err != nil {
panic(err)
}
return os.NewFile(fd, os.Stderr.Name())
}()