Skip to content

Commit

Permalink
Use unix.Dup2 in RedirectStandardError (#9493)
Browse files Browse the repository at this point in the history
The function syscall.Dup2 does not exist for all architectures in the
stdlib, but the unix.Dup2 does. Replace it, so to fix compilation on
other os/arch combinations.
  • Loading branch information
Steffen Siering committed Dec 13, 2018
1 parent 220cdee commit 5d79657
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions libbeat/common/file/stderr_other.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,12 @@ package file

import (
"os"
"syscall"

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

// RedirectStandardError causes all standard error output to be directed to the
// given file.
func RedirectStandardError(toFile *os.File) error {
return syscall.Dup2(int(toFile.Fd()), 2)
return unix.Dup2(int(toFile.Fd()), 2)
}

0 comments on commit 5d79657

Please sign in to comment.