Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Streaming "get" prints logging info to STDOUT instead of STDERR #822

Open
riskhanna opened this issue Jan 12, 2017 · 2 comments
Open

Streaming "get" prints logging info to STDOUT instead of STDERR #822

riskhanna opened this issue Jan 12, 2017 · 2 comments

Comments

@riskhanna
Copy link

In version >1.6, when you using the streaming get functionality (s3cmd get s3://BUCKETNAME -), there is some logging information that is printed to STDOUT instead of STDERR that prevents me from piping the data to other tools (for example, piping json data to jq).

$ s3cmd get s3://rishi-test-s3cmd/test.txt - 2> /dev/null
download: 's3://rishi-test-s3cmd/test.txt' -> '-'  [1 of 1]
download: 's3://rishi-test-s3cmd/test.txt' -> '-'  [1 of 1]
Hello, World
My name is Rishi
 30 of 30   100% in    0s   165.59 B/s  done

Can this be altered so that logging info is printed to STDERR?

@mdomsch
Copy link
Contributor

mdomsch commented Feb 7, 2017

I looked at this a bit last night. First, replacing stdout with a new file descriptor to /dev/null, when --quiet is sent, is the wrong thing to do. This is addressed in new branch bug/stdout for consideration:
https://github.com/s3tools/s3cmd/tree/bug/stdout

Now when using get --quiet, all output() messages are not emitted. There is still one progress message getting printed which I haven't figured out why.

We've got a couple choices:

  1. Omit printing these status messages to stdout when destination for a file is stdout (effectively what --progress/no-progress does)
  2. Print these status messages to stderr instead

With the above branch, and --quiet --no-progress, I get the desired result - no progress message is printed, and the stdout contains the file just downloaded. I'd prefer for that last status message, with 'done' on the end, to automatically not be printed, just like the other status messages aren't printed. Need to see why that's happening...

@fviard fviard added this to the 2.2.0 milestone Apr 7, 2020
@fviard fviard modified the milestones: 2.2.0, 2.3.0 Oct 14, 2021
@fviard fviard modified the milestones: 2.3.0, 2.4.0 Oct 2, 2022
@ctrlcctrlv
Copy link

Fixed by #1315.

@fviard fviard modified the milestones: 2.4.0, 2.5.0 Dec 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants