Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

solcx wrapper misinterpreting solc --help return code #132

Open
boxydog opened this issue Nov 9, 2021 · 1 comment
Open

solcx wrapper misinterpreting solc --help return code #132

boxydog opened this issue Nov 9, 2021 · 1 comment

Comments

@boxydog
Copy link

boxydog commented Nov 9, 2021

Environment information

  • py-solc-x Version: 1.1.1
  • solc Version: 0.8.10
  • Python Version: 3.9.7
  • OS: osx

What was wrong?

Code (pretty much straight from https://web3py.readthedocs.io/en/stable/contracts.html):

    source = open('solidity/contracts/Greeter.sol').read()
    compiled_sol = solcx.compile_source(source)

Expected output: no errors
Actual output: solc returned 0, solc_wrapper expected 1 from help, so it throws an error

Abbreviated output:

solcx.exceptions.SolcError: An error occurred during execution
> command: `/Users/zzz/.solcx/solc-v0.8.10 --help -`
> return code: `0`
> stdout:
solc, the Solidity commandline compiler.

...

Test outside of solcx showing solc returns 0:

$ /Users/zzz/.solcx/solc-v0.8.10 --help -
solc, the Solidity commandline compiler.
...

$ echo $?
0

Full output attached:
eth1.txt

How can it be fixed?

Change solc_wrapper to always expect 0 at this line?

@cameel
Copy link

cameel commented Nov 9, 2021

Just a heads up - older solc versions do return 1 from --help. The change is pretty fresh - it has been fixed in 0.8.10, which was just released (see ethereum/solidity#12118).

It should have been 0 for --help all along since the compiler really does what is requested and it's not a failure. The only reason it was counted as one was that it was being handled by the same code that detects no arguments and prints help. No arguments on the command line is a case where we do want an error - it's still one, even on 0.8.10.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants