-
-
Notifications
You must be signed in to change notification settings - Fork 660
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
retracing steps by re-adding syscallDup along with variations for mor…
…e GOOS
- Loading branch information
1 parent
37c2426
commit 7d237fd
Showing
6 changed files
with
102 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
// +build plan9 | ||
|
||
package remote | ||
|
||
import ( | ||
"syscall" | ||
) | ||
|
||
// Plan9 doesn't have syscall.Dup2 which ginkgo uses, so | ||
// use the identical syscall.Dup instead | ||
func syscallDup(oldfd int, newfd int) (err error) { | ||
_, err := syscall.Dup(oldfd, newfd, 0) | ||
return err | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
// +build solaris | ||
|
||
package remote | ||
|
||
import "golang.org/x/sys/unix" | ||
|
||
func syscallDup(oldfd int, newfd int) (err error) { | ||
return unix.Dup2(oldfd, newfd) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
// +build !linux !arm64 | ||
// +build !windows | ||
// +build !solaris | ||
// +build !plan9 | ||
|
||
package remote | ||
|
||
import "syscall" | ||
|
||
func syscallDup(oldfd int, newfd int) (err error) { | ||
return syscall.Dup2(oldfd, newfd) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
// +build windows | ||
|
||
package remote | ||
|
||
import ( | ||
"errors" | ||
|
||
"golang.org/x/sys/windows" | ||
) | ||
|
||
func syscallDup(oldfd int, newfd int) (err error) { | ||
var stdfd uint32 | ||
switch newfd { | ||
case 1: | ||
stdfd = windows.STD_OUTPUT_HANDLE | ||
case 2: | ||
stdfd = windows.STD_ERROR_HANDLE | ||
default: | ||
return errors.New("unrecognized newfd: %d", newfd) | ||
} | ||
return windows.SetStdHandle(stdfd, windows.Handle(oldfd)) | ||
} |