feat: 适配 linux_arm64 windows 环境
This commit is contained in:
committed by
zhengkunwang223
parent
25508011e1
commit
e8caec4603
20
backend/log/dup_write_linux_arm64.go
Normal file
20
backend/log/dup_write_linux_arm64.go
Normal 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
|
||||
}
|
||||
Reference in New Issue
Block a user