fix: linux arm64 build error (Dup2 is not available, use unix.Dup2)
This commit is contained in:
@@ -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()))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user