2015-02-27 16:51:17 +00:00
|
|
|
// Log the panic under unix to the log file
|
|
|
|
|
2016-02-24 21:54:21 +00:00
|
|
|
// +build darwin dragonfly freebsd linux nacl netbsd openbsd
|
2015-02-27 16:51:17 +00:00
|
|
|
|
2016-08-04 21:18:56 +00:00
|
|
|
package cmd
|
2015-02-27 16:51:17 +00:00
|
|
|
|
|
|
|
import (
|
|
|
|
"log"
|
|
|
|
"os"
|
|
|
|
"syscall"
|
|
|
|
)
|
|
|
|
|
|
|
|
// redirectStderr to the file passed in
|
|
|
|
func redirectStderr(f *os.File) {
|
|
|
|
err := syscall.Dup2(int(f.Fd()), int(os.Stderr.Fd()))
|
|
|
|
if err != nil {
|
|
|
|
log.Fatalf("Failed to redirect stderr to file: %v", err)
|
|
|
|
}
|
|
|
|
}
|