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-11-11 15:13:49 +01:00

18 lines
248 B
Go

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