From 8b9a18ce017d40f99ee5f74da5c4fbb8a47538f9 Mon Sep 17 00:00:00 2001 From: "odyslam.eth" Date: Sat, 29 Jan 2022 11:32:38 +0300 Subject: [PATCH] chore: add info messages to solc install/compile (#838) * chore: add info messages to solc install/compile * chore: update changelog * fix: remove added ';' * Update ethers-solc/src/compile.rs Co-authored-by: Georgios Konstantopoulos --- CHANGELOG.md | 1 + ethers-solc/src/compile.rs | 9 ++++++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index cf71a070..2da9d132 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -22,6 +22,7 @@ and no nonce is specified - Move `fill_transaction` implementation to the provider, to allow middleware to properly override its behavior. +- Add informational messages to solc installation and compilation. ## ethers-contract-abigen diff --git a/ethers-solc/src/compile.rs b/ethers-solc/src/compile.rs index 006e9c27..5153591b 100644 --- a/ethers-solc/src/compile.rs +++ b/ethers-solc/src/compile.rs @@ -409,14 +409,19 @@ impl Solc { #[cfg(feature = "svm")] pub async fn install(version: &Version) -> std::result::Result<(), svm::SolcVmError> { tracing::trace!("installing solc version \"{}\"", version); - svm::install(version).await + println!("installing solc version \"{}\"", version); + let result = svm::install(version).await; + println!("installation complete"); + result } /// Blocking version of `Self::install` #[cfg(all(feature = "svm", feature = "async"))] pub fn blocking_install(version: &Version) -> std::result::Result<(), svm::SolcVmError> { tracing::trace!("blocking installing solc version \"{}\"", version); + println!("installing solc version \"{}\"", version); tokio::runtime::Runtime::new().unwrap().block_on(svm::install(version))?; + println!("installation completed"); Ok(()) } @@ -483,7 +488,6 @@ impl Solc { pub fn compile_output(&self, input: &T) -> Result> { let mut cmd = Command::new(&self.solc); - let mut child = cmd .args(&self.args) .arg("--standard-json") @@ -493,7 +497,6 @@ impl Solc { .spawn() .map_err(|err| SolcError::io(err, &self.solc))?; let stdin = child.stdin.take().unwrap(); - serde_json::to_writer(stdin, input)?; compile_output(child.wait_with_output().map_err(|err| SolcError::io(err, &self.solc))?) }