Move internals of rclone command into cmd so it can be imported externally

This commit is contained in:
Nick Craig-Wood
2016-08-04 22:33:46 +01:00
parent 549cac90af
commit 0a7b34eefc
7 changed files with 842 additions and 830 deletions
+19
View File
@@ -0,0 +1,19 @@
// Log the panic under unix to the log file
// +build darwin dragonfly freebsd linux nacl netbsd openbsd
package cmd
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)
}
}