"rsync for cloud storage" - Google Drive, S3, Dropbox, Backblaze B2, One Drive, Swift, Hubic, Wasabi, Google Cloud Storage, Azure Blob, Azure Files, Yandex Files
Go azure-blobazure-blob-storageazure-filesbackblaze-b2cloud-storagedropboxencryptionftpfuse-filesystemgogolanggoogle-cloud-storagegoogle-driveonedriveopenstack-swiftrclones3sftpsyncwebdav
cmd: fix --progress crash under Windows Jenkins - fixes #2846
Nick Craig-Wood9012d7c6c155
diff --git a/cmd/progress.go b/cmd/progress.goindex ef21fd9a8..f6550a5bc 100644--- a/cmd/progress.go+++ b/cmd/progress.go@@ -27,6 +27,11 @@ const (//// It returns a func which should be called to stop the stats.func startProgress() func() {+ err := initTerminal()+ if err != nil {+ fs.Errorf(nil, "Failed to start progress: %v", err)+ return func() {}+ }stopStats := make(chan struct{})oldLogPrint := fs.LogPrintif !log.Redirected() {diff --git a/cmd/progress_other.go b/cmd/progress_other.goindex aef00cd4b..ec1e223c7 100644--- a/cmd/progress_other.go+++ b/cmd/progress_other.go@@ -4,6 +4,10 @@ package cmdimport "os"+func initTerminal() error {+ return nil+}+func writeToTerminal(b []byte) {_, _ = os.Stdout.Write(b)}diff --git a/cmd/progress_windows.go b/cmd/progress_windows.goindex e0ee6ffaf..c8943fc24 100644--- a/cmd/progress_windows.go+++ b/cmd/progress_windows.go@@ -5,22 +5,31 @@ package cmdimport ("fmt""os"- "sync"+ "syscall"ansiterm "github.com/Azure/go-ansiterm""github.com/Azure/go-ansiterm/winterm"+ "github.com/pkg/errors")var (- initAnsiParser sync.Once- ansiParser *ansiterm.AnsiParser+ ansiParser *ansiterm.AnsiParser)+func initTerminal() error {+ winEventHandler := winterm.CreateWinEventHandler(os.Stdout.Fd(), os.Stdout)+ if winEventHandler == nil {+ err := syscall.GetLastError()+ if err == nil {+ err = errors.New("initialization failed")+ }+ return errors.Wrap(err, "windows terminal")+ }+ ansiParser = ansiterm.CreateParser("Ground", winEventHandler)+ return nil+}+func writeToTerminal(b []byte) {- initAnsiParser.Do(func() {- winEventHandler := winterm.CreateWinEventHandler(os.Stdout.Fd(), os.Stdout)- ansiParser = ansiterm.CreateParser("Ground", winEventHandler)- })// Remove all non-ASCII characters until this is fixed// https://github.com/Azure/go-ansiterm/issues/26r := []rune(string(b))