fixed issue#2004 parsing solc verison with trailing newlines (#2005)
* fixed issue#2004 parsing solc verison with trailing newlines * suggested changes
This commit is contained in:
parent
08f8e8771a
commit
0841e9b53e
|
@ -686,9 +686,10 @@ fn version_from_output(output: Output) -> Result<Version> {
|
||||||
let version = output
|
let version = output
|
||||||
.stdout
|
.stdout
|
||||||
.lines()
|
.lines()
|
||||||
|
.filter_map(|l| l.ok())
|
||||||
|
.filter(|l| !l.trim().is_empty())
|
||||||
.last()
|
.last()
|
||||||
.ok_or_else(|| SolcError::solc("version not found in solc output"))?
|
.ok_or_else(|| SolcError::solc("version not found in solc output"))?;
|
||||||
.map_err(|err| SolcError::msg(format!("Failed to read output: {err}")))?;
|
|
||||||
// NOTE: semver doesn't like `+` in g++ in build metadata which is invalid semver
|
// 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"))?)
|
Ok(Version::from_str(&version.trim_start_matches("Version: ").replace(".g++", ".gcc"))?)
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in New Issue