"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/ncdu: fix screen corruption when logging
eNV250ea2ce3674bc
diff --git a/cmd/ncdu/ncdu.go b/cmd/ncdu/ncdu.goindex 6fdb210a5..be91907a3 100644--- a/cmd/ncdu/ncdu.go+++ b/cmd/ncdu/ncdu.go@@ -19,6 +19,7 @@ import ("github.com/rclone/rclone/cmd/ncdu/scan""github.com/rclone/rclone/fs""github.com/rclone/rclone/fs/fspath"+ "github.com/rclone/rclone/fs/log""github.com/rclone/rclone/fs/operations""github.com/rivo/uniseg""github.com/spf13/cobra"@@ -911,6 +912,28 @@ func (u *UI) Show() error {if err != nil {return fmt.Errorf("screen init: %w", err)}++ // Hijack fs.LogPrint so that it doesn't corrupt the screen.+ if logPrint := fs.LogPrint; !log.Redirected() {+ type log struct {+ text string+ level fs.LogLevel+ }+ var logs []log+ fs.LogPrint = func(level fs.LogLevel, text string) {+ if len(logs) > 100 {+ logs = logs[len(logs)-100:]+ }+ logs = append(logs, log{level: level, text: text})+ }+ defer func() {+ fs.LogPrint = logPrint+ for i := range logs {+ logPrint(logs[i].level, logs[i].text)+ }+ }()+ }+defer u.s.Fini()// scan the disk in the background