curl / Mailing Lists / curl-users / Single Mail

curl-users

pipe vs. tty: output is different: curl -v google.com vs. curl -v google.com | cat

From: Henrique Vicente de Oliveira Pinto <henriquevicente_at_gmail.com>
Date: Fri, 15 Jun 2018 11:11:48 -0300

Hi,

I'm trying to understand what is happening here...

If I pipe the curl output to another process, I get a different output than
if curl prints directly on stdout.

Example / How to reproduce:

1. curl -v google.com
2. curl -v google.com | cat
then diff both outputs.

On the second time besides getting the multiline progress bar I get some
extra info (especially when using --verbose) -- mostly, lots of "{ [219
bytes data]" blocks.

I have tried using --trace and --trace-ascii to avoid getting such info
lines but failed to figure out how to do so.

Question: What would be the most straight-forward way for me to get exactly
the same output I get when I use curl directly?

This code seems to be the culprit, but I haven't gone deeper into the
matter:

https://github.com/curl/curl/blob/c45360d4633850839bb9c2d77dbf8a8285e9ad49/src/tool_cb_dbg.c#L141-L153

Best regards,

Henrique Vicente
https://henvic.github.io/
https://github.com/henvic
http://flickr.com/photos/henriquev/

-----------------------------------------------------------
Unsubscribe: https://cool.haxx.se/list/listinfo/curl-users
Etiquette: https://curl.haxx.se/mail/etiquette.html
Received on 2018-06-15