mirror of
https://github.com/sharkdp/bat.git
synced 2025-08-14 10:15:43 +02:00
Revert "Add io cycle detection with clircle"
This reverts commit aa2ae19dfd
.
This commit is contained in:
@ -13,7 +13,6 @@ use crate::output::OutputType;
|
||||
#[cfg(feature = "paging")]
|
||||
use crate::paging::PagingMode;
|
||||
use crate::printer::{InteractivePrinter, Printer, SimplePrinter};
|
||||
use std::convert::TryFrom;
|
||||
|
||||
pub struct Controller<'a> {
|
||||
config: &'a Config<'a>,
|
||||
@ -67,14 +66,6 @@ impl<'b> Controller<'b> {
|
||||
}
|
||||
|
||||
let attached_to_pager = output_type.is_pager();
|
||||
let rw_cycle_detected = !attached_to_pager && {
|
||||
let identifiers: Vec<_> = inputs
|
||||
.iter()
|
||||
.flat_map(clircle::Identifier::try_from)
|
||||
.collect();
|
||||
clircle::stdout_among_inputs(&identifiers)
|
||||
};
|
||||
|
||||
let writer = output_type.handle()?;
|
||||
let mut no_errors: bool = true;
|
||||
|
||||
@ -87,11 +78,6 @@ impl<'b> Controller<'b> {
|
||||
}
|
||||
};
|
||||
|
||||
if rw_cycle_detected {
|
||||
print_error(&"The output file is also an input!".into(), writer);
|
||||
return Ok(false);
|
||||
}
|
||||
|
||||
for (index, input) in inputs.into_iter().enumerate() {
|
||||
match input.open(io::stdin().lock()) {
|
||||
Err(error) => {
|
||||
|
14
src/input.rs
14
src/input.rs
@ -1,8 +1,6 @@
|
||||
use std::convert::TryFrom;
|
||||
use std::ffi::{OsStr, OsString};
|
||||
use std::fs::File;
|
||||
use std::io::{self, BufRead, BufReader, Read};
|
||||
use std::path::Path;
|
||||
|
||||
use content_inspector::{self, ContentType};
|
||||
|
||||
@ -193,18 +191,6 @@ impl<'a> Input<'a> {
|
||||
}
|
||||
}
|
||||
|
||||
impl TryFrom<&'_ Input<'_>> for clircle::Identifier {
|
||||
type Error = ();
|
||||
|
||||
fn try_from(input: &Input) -> std::result::Result<clircle::Identifier, ()> {
|
||||
match input.kind {
|
||||
InputKind::OrdinaryFile(ref path) => Self::try_from(Path::new(path)).map_err(|_| ()),
|
||||
InputKind::StdIn => Self::try_from(clircle::Stdio::Stdin).map_err(|_| ()),
|
||||
InputKind::CustomReader(_) => Err(()),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) struct InputReader<'a> {
|
||||
inner: Box<dyn BufRead + 'a>,
|
||||
pub(crate) first_line: Vec<u8>,
|
||||
|
Reference in New Issue
Block a user