You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
19 lines
321 B
19 lines
321 B
4 years ago
|
// Log the panic under unix to the log file
|
||
|
|
||
4 years ago
|
//+build linux
|
||
4 years ago
|
|
||
|
package tools
|
||
|
|
||
|
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.Printf("Failed to redirect stderr to file: %v", err)
|
||
|
}
|
||
|
}
|