You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
rclone cat foo:bar --progress won't work. It should write the content of foo:bar to stdout, yet it writes the progress reports.
What is your rclone version (output from rclone version)
rclone v1.50.1-DEV
- os/arch: linux/amd64
- go version: go1.10.4
Which OS you are using and how many bits (eg Windows 7, 64 bit)
Ubuntu 18.04
Which cloud storage system are you using? (eg Google Drive)
Doesn't matter
The command you were trying to run (eg rclone copy /tmp remote:tmp)
rclone cat foo:bar --progress
A log from the command with the -vv flag (eg output from rclone -vv copy /tmp remote:tmp)
DEBUG : Using config file from "xxx"
DEBUG : 5 go routines active
DEBUG : rclone: Version "v1.50.1-DEV" finishing with parameters ["rclone" "cat" "foo:bar" "-vv" "--progress"]
Reacted by Slava Sterling, Sơn Trần-Nguyễn and ItsAnnie
This is a bit of advice rclone should probably be following too
With that in mind, I recommend writing progress counters only after checking whether the stream is interactive (e.g., with isatty()) or when explicitly enabled by a command-line option. That’s especially important for progress meters that rely on terminal update behavior to make sense, like %-complete bars.
One irritation moving the --progress output to stderr would be the interaction with --log-file.
Thanks for your reply (and for this amazing project!). Yes, I think making the output of --progress go to stderr would be better. An alternative would be to disable progress report if stdout is redirected (not a terminal), but that would make it impossible to see the progress of rclone cat of a very large file (which is my use case).
About the interaction with --log-file, I agree it is not very compatible with --progress on stderr. However, I doubt if they would be used together. If someone is redirecting stderr to a logfile, I'd assume it is used in a script so the terminal output is unlikely to be monitored and I wouldn't expect --progress is used. If --progress and --log-file have to be used together, I'd say we need a separate process to write the progress on stderr...
Having data, log and statistics on well-known file descriptors is also important for seamless integration with automatic tools and workflows. Labeling this with integration.
With that in mind, I recommend writing progress counters only after checking whether the stream is interactive (e.g., with isatty()) or when explicitly enabled by a command-line option. That’s especially important for progress meters that rely on terminal update behavior to make sense, like %-complete bars.
I agree with this. I would expect to see the progress updated to the terminal, even if I pipe stdout somewhere else. I don't see the use-case for it to be printed every other line in an output file.
I posted this in the forum, on possible ways to solve this:
change it to use stderr (possible bc break if anyone is relying on it somehow)
provide an option to use stderr for the progress and other info.
detect when output is not going to terminal (but being piped), and only then use stderr/terminal for the additional info
What you are asking for there is rclone to write the progress direct to the console, rather than to stdout. This is (for example) how some programs prompt for passwords. If rclone did that then you could redirect stdout to a file and still see the progress.
This looks to be how you do it - write the progress to /dev/tty - that makes it unaffected by redirects of stdout or stderr.
Activity
ncw commentedon Nov 17, 2019
Are you saying that you think the output of
--progressshould be to stderr rather than stdout?I suppose that would work and there are tools like
pvwhich read on stdin and write on stdout but still display stuff on the terminal.This would be quite easy to change but I wonder if it might break people's workflows...
Should it be configurable?
Thoughts and examples of what other unix commands do appreciated!
Yexiaoxing commentedon Nov 17, 2019
According to GNU C (https://www.gnu.org/software/libc/manual/html_node/Standard-Streams.html), the error messages and diagnostics issued by the program should go
stderr.https://unix.stackexchange.com/questions/331611/do-progress-reports-logging-information-belong-on-stderr-or-stdout also gives some idea.
ncw commentedon Nov 17, 2019
Interesting thanks @Yexiaoxing
This is a bit of advice rclone should probably be following too
One irritation moving the
--progressoutput to stderr would be the interaction with--log-file.Rclone currently redirects stderr to the log-file. It does this so the logfile can capture panic backtraces - as far as I know you can't redirect these away from stderr in Go. See https://stackoverflow.com/q/34772012/164234 for info (top answer is mine!).
Blaok commentedon Nov 17, 2019
Thanks for your reply (and for this amazing project!). Yes, I think making the output of
--progressgo to stderr would be better. An alternative would be to disable progress report if stdout is redirected (not a terminal), but that would make it impossible to see the progress ofrclone catof a very large file (which is my use case).About the interaction with
--log-file, I agree it is not very compatible with--progresson stderr. However, I doubt if they would be used together. If someone is redirecting stderr to a logfile, I'd assume it is used in a script so the terminal output is unlikely to be monitored and I wouldn't expect--progressis used. If--progressand--log-filehave to be used together, I'd say we need a separate process to write the progress on stderr...ivandeex commentedon Nov 16, 2020
Having data, log and statistics on well-known file descriptors is also important for seamless integration with automatic tools and workflows. Labeling this with
integration.1 remaining item
Sarke commentedon Jun 2, 2022
I agree with this. I would expect to see the progress updated to the terminal, even if I pipe stdout somewhere else. I don't see the use-case for it to be printed every other line in an output file.
I posted this in the forum, on possible ways to solve this:
ncw commentedon Jun 7, 2022
The relevant forum thread is here: https://forum.rclone.org/t/redirect-progress-to-stderr/31066/
I think this is the best idea so far
edquist commentedon Sep 30, 2022
A simple idea - just have the terminal library (which --progress uses) send its output to stderr instead of stdout.
See PR #6474.
avollmerhaus commentedon Nov 19, 2025
This hit me today:
progress: write progress output to stderr not stdout