Skip to content

Commit

Permalink
fixed issue#2004 parsing solc verison with trailing newlines (#2005)
Browse files Browse the repository at this point in the history
* fixed issue#2004 parsing solc verison with trailing newlines

* suggested changes
  • Loading branch information
elizabethdinella committed Jan 13, 2023
1 parent 08f8e87 commit 0841e9b
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions ethers-solc/src/compile/mod.rs
Expand Up @@ -686,9 +686,10 @@ fn version_from_output(output: Output) -> Result<Version> {
let version = output
.stdout
.lines()
.filter_map(|l| l.ok())
.filter(|l| !l.trim().is_empty())
.last()
.ok_or_else(|| SolcError::solc("version not found in solc output"))?
.map_err(|err| SolcError::msg(format!("Failed to read output: {err}")))?;
.ok_or_else(|| SolcError::solc("version not found in solc output"))?;
// NOTE: semver doesn't like `+` in g++ in build metadata which is invalid semver
Ok(Version::from_str(&version.trim_start_matches("Version: ").replace(".g++", ".gcc"))?)
} else {
Expand Down

0 comments on commit 0841e9b

Please sign in to comment.