diff --git a/backend/log/dup_write_darwin.go b/backend/log/dup_write_darwin.go index 2a09ac50a..822d24e82 100644 --- a/backend/log/dup_write_darwin.go +++ b/backend/log/dup_write_darwin.go @@ -1,16 +1,16 @@ package log import ( + "golang.org/x/sys/unix" "os" "runtime" - "syscall" ) var stdErrFileHandler *os.File func dupWrite(file *os.File) error { 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 } runtime.SetFinalizer(stdErrFileHandler, func(fd *os.File) { diff --git a/backend/log/dup_write_linux_amd64.go b/backend/log/dup_write_linux.go similarity index 71% rename from backend/log/dup_write_linux_amd64.go rename to backend/log/dup_write_linux.go index 2a09ac50a..822d24e82 100644 --- a/backend/log/dup_write_linux_amd64.go +++ b/backend/log/dup_write_linux.go @@ -1,16 +1,16 @@ package log import ( + "golang.org/x/sys/unix" "os" "runtime" - "syscall" ) var stdErrFileHandler *os.File func dupWrite(file *os.File) error { 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 } runtime.SetFinalizer(stdErrFileHandler, func(fd *os.File) { diff --git a/backend/log/dup_write_linux_arm64.go b/backend/log/dup_write_linux_arm64.go deleted file mode 100644 index 6342c16a9..000000000 --- a/backend/log/dup_write_linux_arm64.go +++ /dev/null @@ -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 -} diff --git a/go.mod b/go.mod index e3ab8907a..2b6c844e3 100644 --- a/go.mod +++ b/go.mod @@ -236,7 +236,7 @@ require ( golang.org/x/mod v0.6.0 // indirect golang.org/x/oauth2 v0.0.0-20221014153046-6fdb5e3db783 // 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/time v0.1.0 // indirect golang.org/x/tools v0.2.0 // indirect diff --git a/go.sum b/go.sum index b119412f8..803878c89 100644 --- a/go.sum +++ b/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.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.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-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210220032956-6a3ed077a48d/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=