mirror of
https://git.sr.ht/~ashkeel/strimertul
synced 2024-09-20 02:00:49 +00:00
18 lines
245 B
Go
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)
|
|
}
|
|
}
|