mirror of
https://git.sr.ht/~ashkeel/strimertul
synced 2024-09-30 02:40:33 +00:00
17 lines
248 B
Go
17 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)
|
|
}
|
|
}
|