Fix a bad slice into erroring utf-8 buffer (#872)

This commit is contained in:
JT
2022-01-28 15:32:46 -05:00
committed by GitHub
parent 020ad24b25
commit 86eeb4a5e7
8 changed files with 44 additions and 19 deletions

View File

@ -121,7 +121,11 @@ impl Command for Open {
let buf_reader = BufReader::new(file);
let output = PipelineData::RawStream(
RawStream::new(Box::new(BufferedReader { input: buf_reader }), ctrlc),
RawStream::new(
Box::new(BufferedReader { input: buf_reader }),
ctrlc,
call_span,
),
call_span,
None,
);

View File

@ -362,6 +362,7 @@ fn response_to_buffer(
input: buffered_input,
}),
engine_state.ctrlc.clone(),
span,
),
span,
None,

View File

@ -42,11 +42,18 @@ impl Command for StrCollect {
// let output = input.collect_string(&separator.unwrap_or_default(), &config)?;
// Hmm, not sure what we actually want. If you don't use debug_string, Date comes out as human readable
// which feels funny
#[allow(clippy::needless_collect)]
let strings: Vec<String> = input
.into_iter()
.map(|value| value.debug_string("\n", &config))
.collect();
let mut strings: Vec<String> = vec![];
for value in input {
match value {
Value::Error { error } => {
return Err(error);
}
value => {
strings.push(value.debug_string("\n", &config));
}
}
}
let output = if let Some(separator) = separator {
strings.join(&separator)

View File

@ -243,7 +243,7 @@ impl ExternalCommand {
let receiver = ChannelReceiver::new(rx);
Ok(PipelineData::RawStream(
RawStream::new(Box::new(receiver), output_ctrlc),
RawStream::new(Box::new(receiver), output_ctrlc, head),
head,
None,
))

View File

@ -72,6 +72,7 @@ impl Command for Table {
.into_iter(),
),
ctrlc,
head,
),
head,
None,
@ -187,6 +188,7 @@ impl Command for Table {
stream,
}),
ctrlc,
head,
),
head,
None,