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

18 lines
248 B
Go
Raw Normal View History

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