Skip to content

Commit 2e5b7ca

Browse files
committed
surface stderr/ errors from solc-select
1 parent a2662cb commit 2e5b7ca

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

crytic_compile/platform/solc.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -384,11 +384,17 @@ 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)
393+
print(stdout)
390394
if len(version) == 0:
391-
raise InvalidCompilation(f"Solidity version not found: {stdout}")
395+
raise InvalidCompilation(
396+
f"\nSolidity version not found:\nSTDOUT:\n{stdout}\nSTDERR:\n{stderr}"
397+
)
392398
return version[0]
393399
except OSError as error:
394400
# pylint: disable=raise-missing-from

0 commit comments

Comments
 (0)