fix: linux arm64 build error (Dup2 is not available, use unix.Dup2)

This commit is contained in:
Jose Luis Montañes Ojados
2026-01-17 02:38:50 +01:00
parent 3a1db4e80c
commit 36111ff781

View File

@@ -4,7 +4,8 @@ package main
import (
"os"
"syscall"
"golang.org/x/sys/unix"
)
func redirectStderr(f *os.File) {
@@ -12,12 +13,12 @@ func redirectStderr(f *os.File) {
// Silence altogether if no debug file
null, err := os.OpenFile(os.DevNull, os.O_WRONLY, 0)
if err == nil {
syscall.Dup2(int(null.Fd()), int(os.Stderr.Fd()))
_ = unix.Dup2(int(null.Fd()), int(os.Stderr.Fd()))
}
return
}
// Redirect fd 2 (stderr) to our debug file
// This captures C-level library noise (ALSA, PortAudio) into the log
syscall.Dup2(int(f.Fd()), int(os.Stderr.Fd()))
_ = unix.Dup2(int(f.Fd()), int(os.Stderr.Fd()))
}