From 22ba1d8e5ee38240f4f7356a3b168599737b1ae6 Mon Sep 17 00:00:00 2001 From: iulianpascalau Date: Sun, 22 Sep 2019 19:38:02 +0300 Subject: [PATCH] fixed redirect std err on darwin os --- core/logger/redirectStderrDarwin.go | 18 ++++++++++++++++++ core/logger/redirectStderrLinux.go | 2 +- 2 files changed, 19 insertions(+), 1 deletion(-) create mode 100644 core/logger/redirectStderrDarwin.go diff --git a/core/logger/redirectStderrDarwin.go b/core/logger/redirectStderrDarwin.go new file mode 100644 index 00000000000..e7fba6f64a4 --- /dev/null +++ b/core/logger/redirectStderrDarwin.go @@ -0,0 +1,18 @@ +//+build darwin + +package logger + +import ( + "os" + "syscall" +) + +// redirectStderr redirects the output of the stderr to the file passed in +func redirectStderr(f *os.File) error { + err := syscall.Dup2(int(f.Fd()), int(os.Stderr.Fd())) + if err != nil { + return err + } + + return nil +} diff --git a/core/logger/redirectStderrLinux.go b/core/logger/redirectStderrLinux.go index 7aed514fd69..7316f8c3827 100644 --- a/core/logger/redirectStderrLinux.go +++ b/core/logger/redirectStderrLinux.go @@ -1,4 +1,4 @@ -//+build linux darwin +//+build linux package logger