Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

solve the undefined: unix.Dup2 compile error on mips64le #680

Merged
merged 1 commit into from
Jun 9, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions internal/remote/output_interceptor_darwin.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// +build darwin

package remote

import (
"golang.org/x/sys/unix"
)

func interceptorDupx(oldfd int, newfd int) {
unix.Dup2(oldfd, newfd)
}
11 changes: 11 additions & 0 deletions internal/remote/output_interceptor_dragonfly.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// +build dragonfly

package remote

import (
"golang.org/x/sys/unix"
)

func interceptorDupx(oldfd int, newfd int) {
unix.Dup2(oldfd, newfd)
}
11 changes: 11 additions & 0 deletions internal/remote/output_interceptor_freebsd.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// +build freebsd

package remote

import (
"golang.org/x/sys/unix"
)

func interceptorDupx(oldfd int, newfd int) {
unix.Dup2(oldfd, newfd)
}
12 changes: 12 additions & 0 deletions internal/remote/output_interceptor_linux.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
// +build linux
// +build !mips64le

package remote

import (
"golang.org/x/sys/unix"
)

func interceptorDupx(oldfd int, newfd int) {
unix.Dup2(oldfd, newfd)
}
12 changes: 12 additions & 0 deletions internal/remote/output_interceptor_linux_mips64le.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
// +build linux
// +build mips64le

package remote

import (
"golang.org/x/sys/unix"
)

func interceptorDupx(oldfd int, newfd int) {
unix.Dup3(oldfd, newfd, 0)
}
11 changes: 11 additions & 0 deletions internal/remote/output_interceptor_netbsd.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// +build netbsd

package remote

import (
"golang.org/x/sys/unix"
)

func interceptorDupx(oldfd int, newfd int) {
unix.Dup2(oldfd, newfd)
}
11 changes: 11 additions & 0 deletions internal/remote/output_interceptor_openbsd.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// +build openbsd

package remote

import (
"golang.org/x/sys/unix"
)

func interceptorDupx(oldfd int, newfd int) {
unix.Dup2(oldfd, newfd)
}
11 changes: 11 additions & 0 deletions internal/remote/output_interceptor_solaris.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// +build solaris

package remote

import (
"golang.org/x/sys/unix"
)

func interceptorDupx(oldfd int, newfd int) {
unix.Dup2(oldfd, newfd)
}
7 changes: 2 additions & 5 deletions internal/remote/output_interceptor_unix.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import (
"os"

"github.com/nxadm/tail"
"golang.org/x/sys/unix"
)

func NewOutputInterceptor() OutputInterceptor {
Expand Down Expand Up @@ -36,10 +35,8 @@ func (interceptor *outputInterceptor) StartInterceptingOutput() error {
return err
}

// This might call Dup3 if the dup2 syscall is not available, e.g. on
// linux/arm64 or linux/riscv64
unix.Dup2(int(interceptor.redirectFile.Fd()), 1)
unix.Dup2(int(interceptor.redirectFile.Fd()), 2)
interceptorDupx(int(interceptor.redirectFile.Fd()), 1)
interceptorDupx(int(interceptor.redirectFile.Fd()), 2)

if interceptor.streamTarget != nil {
interceptor.tailer, _ = tail.TailFile(interceptor.redirectFile.Name(), tail.Config{Follow: true})
Expand Down