Skip to content

Commit bcc4293

Browse files
authored
Merge pull request #353 from crytic/output-solc-stderr
surface stderr/ errors from solc-select
2 parents fe27372 + 82320e1 commit bcc4293

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

crytic_compile/platform/solc.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -384,11 +384,16 @@ def get_version(solc: str, env: Optional[Dict[str, str]]) -> str:
384384
env=env,
385385
executable=shutil.which(cmd[0]),
386386
) as process:
387-
stdout_bytes, _ = process.communicate()
388-
stdout = stdout_bytes.decode() # convert bytestrings to unicode strings
387+
stdout_bytes, stderr_bytes = process.communicate()
388+
stdout, stderr = (
389+
stdout_bytes.decode(errors="backslashreplace"),
390+
stderr_bytes.decode(errors="backslashreplace"),
391+
) # convert bytestrings to unicode strings
389392
version = re.findall(r"\d+\.\d+\.\d+", stdout)
390393
if len(version) == 0:
391-
raise InvalidCompilation(f"Solidity version not found: {stdout}")
394+
raise InvalidCompilation(
395+
f"\nSolidity version not found:\nSTDOUT:\n{stdout}\nSTDERR:\n{stderr}"
396+
)
392397
return version[0]
393398
except OSError as error:
394399
# pylint: disable=raise-missing-from

0 commit comments

Comments
 (0)