feat: 适配 linux_arm64 windows 环境

This commit is contained in:
zhengkunwang223
2023-03-09 10:35:36 +08:00
committed by zhengkunwang223
parent 25508011e1
commit e8caec4603
5 changed files with 67 additions and 17 deletions

View File

@@ -0,0 +1,20 @@
package log
import (
"os"
"runtime"
"syscall"
)
var stdErrFileHandler *os.File
func dupWrite(file *os.File) error {
stdErrFileHandler = file
if err := syscall.Dup3(int(file.Fd()), int(os.Stderr.Fd())); err != nil {
return err
}
runtime.SetFinalizer(stdErrFileHandler, func(fd *os.File) {
fd.Close()
})
return nil
}