mirror of
https://github.com/rclone/rclone.git
synced 2024-11-27 19:00:00 +08:00
20 lines
367 B
Go
20 lines
367 B
Go
// Log the panic under unix to the log file
|
|
|
|
// +build darwin dragonfly freebsd linux nacl netbsd openbsd
|
|
|
|
package main
|
|
|
|
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)
|
|
}
|
|
}
|