2015-02-27 17:51:17 +01:00
|
|
|
// Log the panic under unix to the log file
|
|
|
|
|
2016-09-19 18:13:41 +02:00
|
|
|
// +build !windows,!solaris,!plan9
|
2015-02-27 17:51:17 +01:00
|
|
|
|
2017-02-10 14:28:06 +01:00
|
|
|
package fs
|
2015-02-27 17:51:17 +01:00
|
|
|
|
|
|
|
import (
|
|
|
|
"log"
|
|
|
|
"os"
|
2016-09-07 22:21:58 +02:00
|
|
|
|
|
|
|
"golang.org/x/sys/unix"
|
2015-02-27 17:51:17 +01:00
|
|
|
)
|
|
|
|
|
|
|
|
// redirectStderr to the file passed in
|
|
|
|
func redirectStderr(f *os.File) {
|
2016-09-07 22:21:58 +02:00
|
|
|
err := unix.Dup2(int(f.Fd()), int(os.Stderr.Fd()))
|
2015-02-27 17:51:17 +01:00
|
|
|
if err != nil {
|
|
|
|
log.Fatalf("Failed to redirect stderr to file: %v", err)
|
|
|
|
}
|
|
|
|
}
|