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. //! compiling contracts to PolkaVM (PVM) bytecode.
use std::{ use std::{
os::unix::process::CommandExt,
path::PathBuf, path::PathBuf,
process::{Command, Stdio}, process::{Command, Stdio},
}; };
@@ -92,11 +93,14 @@ impl SolidityCompiler for Resolc {
}; };
let mut command = AsyncCommand::new(&self.resolc_path); let mut command = AsyncCommand::new(&self.resolc_path);
command unsafe {
.stdin(Stdio::piped()) command
.stdout(Stdio::piped()) .stdin(Stdio::piped())
.stderr(Stdio::piped()) .stdout(Stdio::piped())
.arg("--standard-json"); .stderr(Stdio::piped())
.arg("--standard-json")
.pre_exec(|| Ok(()))
};
if let Some(ref base_path) = base_path { if let Some(ref base_path) = base_path {
command.arg("--base-path").arg(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: // 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 // 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()) let output = unsafe {
.arg("--version") Command::new(self.resolc_path.as_path())
.stdout(Stdio::piped()) .arg("--version")
.spawn()? .stdout(Stdio::piped())
.wait_with_output()? .pre_exec(|| Ok(()))
.stdout; .spawn()?
.wait_with_output()?
.stdout
};
let output = String::from_utf8_lossy(&output); let output = String::from_utf8_lossy(&output);
let version_string = output let version_string = output
.split("version ") .split("version ")
+16 -9
View File
@@ -2,6 +2,7 @@
//! compiling contracts to EVM bytecode. //! compiling contracts to EVM bytecode.
use std::{ use std::{
os::unix::process::CommandExt,
path::PathBuf, path::PathBuf,
process::{Command, Stdio}, process::{Command, Stdio},
}; };
@@ -102,11 +103,14 @@ impl SolidityCompiler for Solc {
}; };
let mut command = AsyncCommand::new(&self.solc_path); let mut command = AsyncCommand::new(&self.solc_path);
command unsafe {
.stdin(Stdio::piped()) command
.stdout(Stdio::piped()) .stdin(Stdio::piped())
.stderr(Stdio::piped()) .stdout(Stdio::piped())
.arg("--standard-json"); .stderr(Stdio::piped())
.arg("--standard-json")
.pre_exec(|| Ok(()))
};
if let Some(ref base_path) = base_path { if let Some(ref base_path) = base_path {
command.arg("--base-path").arg(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 // Version: 0.8.30+commit.73712a01.Darwin.appleclang
// ``` // ```
let child = Command::new(self.solc_path.as_path()) let child = unsafe {
.arg("--version") Command::new(self.solc_path.as_path())
.stdout(Stdio::piped()) .arg("--version")
.spawn()?; .stdout(Stdio::piped())
.pre_exec(|| Ok(()))
.spawn()
}?;
let output = child.wait_with_output()?; let output = child.wait_with_output()?;
let output = String::from_utf8_lossy(&output.stdout); let output = String::from_utf8_lossy(&output.stdout);
let version_line = output let version_line = output