Skip to content

Commit 6e886fa

Browse files
committed
platform: solc_standard_json: resolve path before passing it to solc
solc <= 0.4.17 do not appear to interpret relative paths in `--allow-paths` which causes compilation errors. By manually resolving the path, we can get a successful solc execution. Fixes: #300
1 parent 1676d53 commit 6e886fa

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

crytic_compile/platform/solc_standard_json.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import json
55
import logging
66
import os
7+
from pathlib import Path
78
import shutil
89
import subprocess
910
from typing import TYPE_CHECKING, Dict, List, Optional, Union, Any
@@ -132,7 +133,8 @@ def run_solc_standard_json(
132133
Returns:
133134
Dict: Solc json output
134135
"""
135-
cmd = [compiler_version.compiler, "--standard-json", "--allow-paths", "."]
136+
working_dir_resolved = Path(working_dir if working_dir else ".").resolve()
137+
cmd = [compiler_version.compiler, "--standard-json", "--allow-paths", str(working_dir_resolved)]
136138
additional_kwargs: Dict = {"cwd": working_dir} if working_dir else {}
137139

138140
env = dict(os.environ)

0 commit comments

Comments
 (0)