curl / Mailing Lists / curl-users / Single Mail

curl-users

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

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Sun, 17 Jun 2018 00:49:28 +0200 (CEST)

On Fri, 15 Jun 2018, Henrique Vicente de Oliveira Pinto wrote:

> 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.

In the second case, curl determines that you're not sending the output to the
terminal, stdout or stderr so the verbose info shows something about the data
that it passes on.

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

That output is part of the verbose output logic enabled with -v, whereas
--trace and --trace-ascii show it differently.

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

curl doesn't give you that option to my recollection. When you get the output
to the terminal or "in your face" you get to see the data so I've reasoned
that there's then no point in telling that it received data!

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