eth-sri / securify

[DEPRECATED] Security Scanner for Ethereum Smart Contracts
Apache License 2.0
215 stars 50 forks source link

Display solc errorstream in System.err #25

Closed EnergyFusion closed 5 years ago

EnergyFusion commented 5 years ago

Proposed solution for #24

Securify reports a generic IOException when solc fails.

This PR addresses that by collecting the solc Process' ErrorStream and piping it out to System.err

A check to see that the first line has 'Error' is so that the Warnings from solc are not printed when there are no errors.

EnergyFusion commented 5 years ago

Now that it's using the ProcessBuilder.Redirect You need to remember to split the output otherwise you don't get a clean json file. Something like:

java -jar build/libs/securify-0.1.jar -fs src/test/resources/solidity/transaction-reordering.sol >output.json 2>error.log
MatthiasEgli-chainsecurity commented 5 years ago

As long as you use the usual command > output-file syntax it will only catch stdout, producing a valid json file. Of course on the shell you will see both, possibly even intertwined, so there to ignore errors you can redirect them to /dev/null like this:

java -jar build/libs/securify-0.1.jar -fs src/test/resources/solidity/transaction-reordering.sol 2>/dev/null
MatthiasEgli-chainsecurity commented 5 years ago

Approved, @hiqua feel free to merge from my side