fix(solc): canonicalize custom paths
This commit is contained in:
parent
a6918aed2b
commit
cf3339066b
|
@ -103,6 +103,9 @@ impl Solc {
|
|||
/// Gets the ABI for the contracts
|
||||
pub fn build_raw(self) -> Result<HashMap<String, CompiledContractStr>> {
|
||||
let path = self.solc_path.unwrap_or_else(|| PathBuf::from(SOLC));
|
||||
let path = std::fs::canonicalize(&path)
|
||||
.unwrap_or_else(|_| panic!("cannot canonicalize path {:?}", path));
|
||||
|
||||
let mut command = Command::new(&path);
|
||||
let version = Solc::version(Some(path));
|
||||
|
||||
|
@ -227,12 +230,14 @@ impl Solc {
|
|||
///
|
||||
/// # Panics
|
||||
///
|
||||
/// If `solc` is not in the user's $PATH
|
||||
/// If `solc` is not found
|
||||
pub fn version(solc_path: Option<PathBuf>) -> String {
|
||||
let command_output = Command::new(solc_path.unwrap_or_else(|| PathBuf::from(SOLC)))
|
||||
let solc_path = solc_path.unwrap_or_else(|| PathBuf::from(SOLC));
|
||||
let solc_path = std::fs::canonicalize(solc_path).unwrap();
|
||||
let command_output = Command::new(&solc_path)
|
||||
.arg("--version")
|
||||
.output()
|
||||
.unwrap_or_else(|_| panic!("`{}` not in user's $PATH", SOLC));
|
||||
.unwrap_or_else(|_| panic!("`{:?}` not found", solc_path));
|
||||
|
||||
let version = command_output
|
||||
.stdout
|
||||
|
|
Loading…
Reference in New Issue