Skip to content

Commit

Permalink
Merge pull request #209 from luxas/build_on_arm64
Browse files Browse the repository at this point in the history
Add linux_arm64 support
  • Loading branch information
onsi committed Jan 28, 2016
2 parents 887db85 + a0fde42 commit ce9cb06
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 3 deletions.
9 changes: 6 additions & 3 deletions internal/remote/output_interceptor_unix.go
Expand Up @@ -6,7 +6,6 @@ import (
"errors"
"io/ioutil"
"os"
"syscall"
)

func NewOutputInterceptor() OutputInterceptor {
Expand All @@ -31,8 +30,12 @@ func (interceptor *outputInterceptor) StartInterceptingOutput() error {
return err
}

syscall.Dup2(int(interceptor.redirectFile.Fd()), 1)
syscall.Dup2(int(interceptor.redirectFile.Fd()), 2)
// Call a function in ./syscall_dup_*.go
// If building for everything other than linux_arm64,
// use a "normal" syscall.Dup2(oldfd, newfd) call. If building for linux_arm64 (which doesn't have syscall.Dup2)
// call syscall.Dup3(oldfd, newfd, 0). They are nearly identical, see: http://linux.die.net/man/2/dup3
syscallDup(int(interceptor.redirectFile.Fd()), 1)
syscallDup(int(interceptor.redirectFile.Fd()), 2)

return nil
}
Expand Down
11 changes: 11 additions & 0 deletions internal/remote/syscall_dup_linux_arm64.go
@@ -0,0 +1,11 @@
// +build linux,arm64

package remote

import "syscall"

// linux_arm64 doesn't have syscall.Dup2 which ginkgo uses, so
// use the nearly identical syscall.Dup3 instead
func syscallDup(oldfd int, newfd int) (err error) {
return syscall.Dup3(oldfd, newfd, 0)
}
10 changes: 10 additions & 0 deletions internal/remote/syscall_dup_unix.go
@@ -0,0 +1,10 @@
// +build !linux !arm64
// +build !windows

package remote

import "syscall"

func syscallDup(oldfd int, newfd int) (err error) {
return syscall.Dup2(oldfd, newfd)
}

0 comments on commit ce9cb06

Please sign in to comment.