ping(8) does not print it's header line if the standard output is
not a tty(4) and the target host does not respond.

To reproduce:

$ ping -c1 -w1 10.0.0.1 
PING 10.0.0.1 (10.0.0.1): 56 data bytes
--- 10.0.0.1 ping statistics ---
1 packets transmitted, 0 packets received, 100.0% packet loss
$ ping -c1 -w1 10.0.0.1 | cat
--- 10.0.0.1 ping statistics ---
1 packets transmitted, 0 packets received, 100.0% packet loss
$

I think we should make sure stdout(4) is switched to line buffering
mode before printing:

http://www.durlej.net/pingbuf.diff

Regards,
Piotr

Reply via email to