mirror of
https://github.com/1Panel-dev/1Panel.git
synced 2025-01-19 00:09:16 +08:00
feat: 适配 Linux 多架构打包 (#1143)
This commit is contained in:
parent
4b25dafb92
commit
c76c24e102
@ -1,16 +1,16 @@
|
|||||||
package log
|
package log
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"golang.org/x/sys/unix"
|
||||||
"os"
|
"os"
|
||||||
"runtime"
|
"runtime"
|
||||||
"syscall"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
var stdErrFileHandler *os.File
|
var stdErrFileHandler *os.File
|
||||||
|
|
||||||
func dupWrite(file *os.File) error {
|
func dupWrite(file *os.File) error {
|
||||||
stdErrFileHandler = file
|
stdErrFileHandler = file
|
||||||
if err := syscall.Dup2(int(file.Fd()), int(os.Stderr.Fd())); err != nil {
|
if err := unix.Dup2(int(file.Fd()), int(os.Stderr.Fd())); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
runtime.SetFinalizer(stdErrFileHandler, func(fd *os.File) {
|
runtime.SetFinalizer(stdErrFileHandler, func(fd *os.File) {
|
||||||
|
@ -1,16 +1,16 @@
|
|||||||
package log
|
package log
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"golang.org/x/sys/unix"
|
||||||
"os"
|
"os"
|
||||||
"runtime"
|
"runtime"
|
||||||
"syscall"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
var stdErrFileHandler *os.File
|
var stdErrFileHandler *os.File
|
||||||
|
|
||||||
func dupWrite(file *os.File) error {
|
func dupWrite(file *os.File) error {
|
||||||
stdErrFileHandler = file
|
stdErrFileHandler = file
|
||||||
if err := syscall.Dup2(int(file.Fd()), int(os.Stderr.Fd())); err != nil {
|
if err := unix.Dup2(int(file.Fd()), int(os.Stderr.Fd())); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
runtime.SetFinalizer(stdErrFileHandler, func(fd *os.File) {
|
runtime.SetFinalizer(stdErrFileHandler, func(fd *os.File) {
|
@ -1,20 +0,0 @@
|
|||||||
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()), 0); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
runtime.SetFinalizer(stdErrFileHandler, func(fd *os.File) {
|
|
||||||
fd.Close()
|
|
||||||
})
|
|
||||||
return nil
|
|
||||||
}
|
|
2
go.mod
2
go.mod
@ -236,7 +236,7 @@ require (
|
|||||||
golang.org/x/mod v0.6.0 // indirect
|
golang.org/x/mod v0.6.0 // indirect
|
||||||
golang.org/x/oauth2 v0.0.0-20221014153046-6fdb5e3db783 // indirect
|
golang.org/x/oauth2 v0.0.0-20221014153046-6fdb5e3db783 // indirect
|
||||||
golang.org/x/sync v0.1.0 // indirect
|
golang.org/x/sync v0.1.0 // indirect
|
||||||
golang.org/x/sys v0.5.0 // indirect
|
golang.org/x/sys v0.8.0 // indirect
|
||||||
golang.org/x/term v0.5.0 // indirect
|
golang.org/x/term v0.5.0 // indirect
|
||||||
golang.org/x/time v0.1.0 // indirect
|
golang.org/x/time v0.1.0 // indirect
|
||||||
golang.org/x/tools v0.2.0 // indirect
|
golang.org/x/tools v0.2.0 // indirect
|
||||||
|
2
go.sum
2
go.sum
@ -1086,6 +1086,8 @@ golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
|||||||
golang.org/x/sys v0.4.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
golang.org/x/sys v0.4.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
golang.org/x/sys v0.5.0 h1:MUK/U/4lj1t1oPg0HfuXDN/Z1wv31ZJ/YcPiGccS4DU=
|
golang.org/x/sys v0.5.0 h1:MUK/U/4lj1t1oPg0HfuXDN/Z1wv31ZJ/YcPiGccS4DU=
|
||||||
golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
|
golang.org/x/sys v0.8.0 h1:EBmGv8NaZBZTWvrbjNoL6HVt+IVy3QDQpJs7VRIw3tU=
|
||||||
|
golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw=
|
golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw=
|
||||||
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
|
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
|
||||||
golang.org/x/term v0.0.0-20210220032956-6a3ed077a48d/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
|
golang.org/x/term v0.0.0-20210220032956-6a3ed077a48d/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
|
||||||
|
Loading…
x
Reference in New Issue
Block a user