1
0
Fork 0
mirror of https://git.sr.ht/~ashkeel/strimertul synced 2024-09-18 01:50:50 +00:00
strimertul/utils/stderr_unix.go
2023-03-09 12:41:50 +01:00

18 lines
245 B
Go

//go:build unix
package utils
import "os"
import (
"log"
"syscall"
)
func RedirectStderr(f *os.File) {
err := syscall.Dup2(int(f.Fd()), int(os.Stderr.Fd()))
if err != nil {
log.Fatalf("Failed to redirect stderr to file: %v", err)
}
}