fping icon indicating copy to clipboard operation
fping copied to clipboard

fping -Q does not output to standard output

Open ziqingkeshi opened this issue 3 years ago • 1 comments

Hello, Thank you very much for the program. But I have encountered some problems with using fping,here is my system info:

Linux version 3.10.0-1160.el7.x86_64 ([email protected]) (gcc version 4.8.5 20150623 (Red Hat 4.8.5-44) (GCC) ) #1 SMP Mon Oct 19 16:18:59 UTC 2020

When I want to redirect the result of fping -Q command to a file, it didn't work, and output the result to the console,and there is no result in the file either.

image

I tried all kinds of methods, but they didn't work.Finally, I achieved by redirecting stderr:

image

It looks like when "-Q" is used, the output results to standard error. This problem does not occur when the "-Q" parameter is not added, and the results can be obtained from standard output or redirected to a file normally.

I'm not sure if this is an issue and I've been able to achieve what I need, but I still want to figure out this phenomenon.

Looking forward to your reply. Thank you very much!

ziqingkeshi avatar Aug 19 '22 03:08 ziqingkeshi

The -Q flag as you say uses stderr. This calls the print_per_system_splits. Using the -N flag uses print_netdata. With -N flag, stdout redirection works without having to redirect stderr. I do not know why it is important to use stderr with print_per_system_splits. I created a PR for this to change to stdout.

darless avatar Dec 06 '22 21:12 darless

While I agree that fping's use of stdout and stderr is not consistent and could be better, we can't change it now because it would break users calling fping programmatically (i.e. it changes its interface).

schweikert avatar Apr 20 '24 06:04 schweikert