mirror of
https://github.com/rclone/rclone.git
synced 2024-11-08 01:25:14 +01:00
21 lines
351 B
Go
21 lines
351 B
Go
// Log the panic under unix to the log file
|
|
|
|
// +build !windows,!solaris,!plan9
|
|
|
|
package fs
|
|
|
|
import (
|
|
"log"
|
|
"os"
|
|
|
|
"golang.org/x/sys/unix"
|
|
)
|
|
|
|
// redirectStderr to the file passed in
|
|
func redirectStderr(f *os.File) {
|
|
err := unix.Dup2(int(f.Fd()), int(os.Stderr.Fd()))
|
|
if err != nil {
|
|
log.Fatalf("Failed to redirect stderr to file: %v", err)
|
|
}
|
|
}
|