crytic / slither

Static Analyzer for Solidity and Vyper
https://blog.trailofbits.com/2018/10/19/slither-a-solidity-static-analysis-framework/
GNU Affero General Public License v3.0
5.37k stars 975 forks source link

why does slither output to stderr instead of stdout? #753

Open snd opened 3 years ago

snd commented 3 years ago

It's possible I'm missing something obvious or it's some weirdness on my system.

With a fresh install of slither the output of detectors and printers is output to stderr instead of stdout. This goes a bit against unix cli tool expectations and makes piping, grepping, etc more awkward than it has to be.

Aniket-Engg commented 3 years ago

I also see this. Would like to know the reason behind it.

Jaime-Iglesias commented 2 years ago

Yeah I've also noticed this - I will add a few labels maybe this can be changed easily (albeit it might affect already working tooling around Slither).

montyly commented 2 years ago

In the same topic, slither returns the number of results, instead of the traditional status code: https://github.com/crytic/slither/blob/630a74f96b23a397e5a4ccaaf2e5d0d533309ed2/slither/__main__.py#L833

This and stderr are for legacy reasons - but we can change it now

XiaoYao-0 commented 2 years ago

I encountered the same problem. I used the cmd command to run slither in Go, and then used the commonly used if err!=nil to judge the return result. The result kept returning an error, which confuses me.

bohendo commented 2 years ago

How would you all feel about sending compiler warnings to stderr and the rest of the output to stdout so that slither . > output.txt would log solc warnings to the console & all of the slither-specific output would end up in output.txt?

On the other hand, solc warnings are an expected part of the output so maybe sending everything except internal warnings/errors to stdout would be best.

KholdStare commented 1 year ago

Any thoughts on this @0xalpharush ?