mirror of
https://github.com/pezkuwichain/revive.git
synced 2026-06-12 15:11:02 +00:00
Fix stdin support
This commit is contained in:
@@ -12,8 +12,6 @@ use std::path::PathBuf;
|
|||||||
use rayon::iter::{IntoParallelIterator, ParallelIterator};
|
use rayon::iter::{IntoParallelIterator, ParallelIterator};
|
||||||
use serde::Deserialize;
|
use serde::Deserialize;
|
||||||
use serde::Serialize;
|
use serde::Serialize;
|
||||||
#[cfg(target_os = "emscripten")]
|
|
||||||
use std::fs::File;
|
|
||||||
|
|
||||||
use crate::solc::pipeline::Pipeline as SolcPipeline;
|
use crate::solc::pipeline::Pipeline as SolcPipeline;
|
||||||
use crate::solc::standard_json::input::settings::metadata::Metadata as SolcStandardJsonInputSettingsMetadata;
|
use crate::solc::standard_json::input::settings::metadata::Metadata as SolcStandardJsonInputSettingsMetadata;
|
||||||
@@ -43,20 +41,7 @@ pub struct Input {
|
|||||||
impl Input {
|
impl Input {
|
||||||
/// A shortcut constructor from stdin.
|
/// A shortcut constructor from stdin.
|
||||||
pub fn try_from_stdin(solc_pipeline: SolcPipeline) -> anyhow::Result<Self> {
|
pub fn try_from_stdin(solc_pipeline: SolcPipeline) -> anyhow::Result<Self> {
|
||||||
let mut input: Self = serde_json::from_reader({
|
let mut input: Self = serde_json::from_reader(std::io::BufReader::new(std::io::stdin()))?;
|
||||||
#[cfg(target_os = "emscripten")]
|
|
||||||
{
|
|
||||||
std::io::BufReader::new(
|
|
||||||
File::open("/in")
|
|
||||||
.map_err(|error| anyhow::anyhow!("File /in openning error: {}", error))?,
|
|
||||||
)
|
|
||||||
}
|
|
||||||
#[cfg(not(target_os = "emscripten"))]
|
|
||||||
{
|
|
||||||
std::io::BufReader::new(std::io::stdin())
|
|
||||||
}
|
|
||||||
})?;
|
|
||||||
|
|
||||||
input
|
input
|
||||||
.settings
|
.settings
|
||||||
.output_selection
|
.output_selection
|
||||||
|
|||||||
Reference in New Issue
Block a user