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

use python built-in shutil.which instead of shelling out #137

Merged
merged 1 commit into from
Nov 9, 2023

Conversation

f0rki
Copy link
Contributor

@f0rki f0rki commented Dec 10, 2021

What I did

So my original issue was that running which without stderr being redirected to /dev/null results in an ugly error message, when running solcx on a new system without any solc (e.g., in a container).

I switched to python's builtin shutil.which instead of using subprocess, which fixes this and avoids spawning a new process. It is part of the standard library so it should work on all platforms and behave equally. However I have only tested on linux.

How to verify it

previously:

$ python -c 'import solcx; print(solcx.import_installed_solc())'
which: no solc in ($PATH)
[]

and now:

$ python -c 'import solcx; print(solcx.import_installed_solc())'
[]

Checklist

  • I have confirmed that my PR passes all linting checks
  • I have included test cases
  • I have updated the documentation (README.md)
  • I have added an entry to the changelog

@antazoey antazoey merged commit 705c963 into ApeWorX:main Nov 9, 2023
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

Successfully merging this pull request may close these issues.

2 participants