From 2e5b7ca30da5bb31e05c4b636cc3960dd157743a Mon Sep 17 00:00:00 2001 From: alpharush <0xalpharush@protonmail.com> Date: Tue, 10 Jan 2023 10:43:39 -0600 Subject: [PATCH 1/2] surface stderr/ errors from solc-select --- crytic_compile/platform/solc.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/crytic_compile/platform/solc.py b/crytic_compile/platform/solc.py index 3dcf0bc7..8ca1cb2e 100644 --- a/crytic_compile/platform/solc.py +++ b/crytic_compile/platform/solc.py @@ -384,11 +384,17 @@ def get_version(solc: str, env: Optional[Dict[str, str]]) -> str: env=env, executable=shutil.which(cmd[0]), ) as process: - stdout_bytes, _ = process.communicate() - stdout = stdout_bytes.decode() # convert bytestrings to unicode strings + stdout_bytes, stderr_bytes = process.communicate() + stdout, stderr = ( + stdout_bytes.decode(errors="backslashreplace"), + stderr_bytes.decode(errors="backslashreplace"), + ) # convert bytestrings to unicode strings version = re.findall(r"\d+\.\d+\.\d+", stdout) + print(stdout) if len(version) == 0: - raise InvalidCompilation(f"Solidity version not found: {stdout}") + raise InvalidCompilation( + f"\nSolidity version not found:\nSTDOUT:\n{stdout}\nSTDERR:\n{stderr}" + ) return version[0] except OSError as error: # pylint: disable=raise-missing-from From 82320e1066bd28721e0ea0f45d3f8392583110d3 Mon Sep 17 00:00:00 2001 From: alpharush <0xalpharush@protonmail.com> Date: Tue, 10 Jan 2023 10:45:37 -0600 Subject: [PATCH 2/2] remove print --- crytic_compile/platform/solc.py | 1 - 1 file changed, 1 deletion(-) diff --git a/crytic_compile/platform/solc.py b/crytic_compile/platform/solc.py index 8ca1cb2e..3ecdc1c4 100644 --- a/crytic_compile/platform/solc.py +++ b/crytic_compile/platform/solc.py @@ -390,7 +390,6 @@ def get_version(solc: str, env: Optional[Dict[str, str]]) -> str: stderr_bytes.decode(errors="backslashreplace"), ) # convert bytestrings to unicode strings version = re.findall(r"\d+\.\d+\.\d+", stdout) - print(stdout) if len(version) == 0: raise InvalidCompilation( f"\nSolidity version not found:\nSTDOUT:\n{stdout}\nSTDERR:\n{stderr}"