Fix the OS FD error

This commit is contained in:
Omar Abdulla
2025-08-15 16:16:36 +03:00
parent a59e287fa1
commit e19e0a4e7a
2 changed files with 34 additions and 20 deletions
+18 -11
View File
@@ -2,6 +2,7 @@
//! compiling contracts to PolkaVM (PVM) bytecode.
use std::{
os::unix::process::CommandExt,
path::PathBuf,
process::{Command, Stdio},
};
@@ -92,11 +93,14 @@ impl SolidityCompiler for Resolc {
};
let mut command = AsyncCommand::new(&self.resolc_path);
command
.stdin(Stdio::piped())
.stdout(Stdio::piped())
.stderr(Stdio::piped())
.arg("--standard-json");
unsafe {
command
.stdin(Stdio::piped())
.stdout(Stdio::piped())
.stderr(Stdio::piped())
.arg("--standard-json")
.pre_exec(|| Ok(()))
};
if let Some(ref base_path) = base_path {
command.arg("--base-path").arg(base_path);
@@ -215,12 +219,15 @@ impl SolidityCompiler for Resolc {
// Logic for parsing the resolc version from the following string:
// Solidity frontend for the revive compiler version 0.3.0+commit.b238913.llvm-18.1.8
let output = Command::new(self.resolc_path.as_path())
.arg("--version")
.stdout(Stdio::piped())
.spawn()?
.wait_with_output()?
.stdout;
let output = unsafe {
Command::new(self.resolc_path.as_path())
.arg("--version")
.stdout(Stdio::piped())
.pre_exec(|| Ok(()))
.spawn()?
.wait_with_output()?
.stdout
};
let output = String::from_utf8_lossy(&output);
let version_string = output
.split("version ")
+16 -9
View File
@@ -2,6 +2,7 @@
//! compiling contracts to EVM bytecode.
use std::{
os::unix::process::CommandExt,
path::PathBuf,
process::{Command, Stdio},
};
@@ -102,11 +103,14 @@ impl SolidityCompiler for Solc {
};
let mut command = AsyncCommand::new(&self.solc_path);
command
.stdin(Stdio::piped())
.stdout(Stdio::piped())
.stderr(Stdio::piped())
.arg("--standard-json");
unsafe {
command
.stdin(Stdio::piped())
.stdout(Stdio::piped())
.stderr(Stdio::piped())
.arg("--standard-json")
.pre_exec(|| Ok(()))
};
if let Some(ref base_path) = base_path {
command.arg("--base-path").arg(base_path);
@@ -205,10 +209,13 @@ impl SolidityCompiler for Solc {
// Version: 0.8.30+commit.73712a01.Darwin.appleclang
// ```
let child = Command::new(self.solc_path.as_path())
.arg("--version")
.stdout(Stdio::piped())
.spawn()?;
let child = unsafe {
Command::new(self.solc_path.as_path())
.arg("--version")
.stdout(Stdio::piped())
.pre_exec(|| Ok(()))
.spawn()
}?;
let output = child.wait_with_output()?;
let output = String::from_utf8_lossy(&output.stdout);
let version_line = output