Remove take_while from internal iterator (#3301)

This commit is contained in:
Jonathan Turner 2021-04-11 18:29:01 +12:00 committed by GitHub
parent 2e439ca77f
commit 734877338d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -33,15 +33,12 @@ pub(crate) fn run_internal_command(
)? )?
}; };
Ok(InputStream::from_stream( Ok(InputStream::from_stream(InternalIterator {
InternalIterator { command,
command, context: context.clone(),
context: context.clone(), leftovers: vec![],
leftovers: vec![], input: result,
input: result, }))
}
.take_while(|x| !x.is_error()),
))
} }
struct InternalIterator { struct InternalIterator {
@ -73,6 +70,7 @@ impl Iterator for InternalIterator {
CommandAction::Exit(code) => std::process::exit(code), // TODO: save history.txt CommandAction::Exit(code) => std::process::exit(code), // TODO: save history.txt
CommandAction::Error(err) => { CommandAction::Error(err) => {
self.context.error(err); self.context.error(err);
return None;
} }
CommandAction::AutoConvert(tagged_contents, extension) => { CommandAction::AutoConvert(tagged_contents, extension) => {
let contents_tag = tagged_contents.tag.clone(); let contents_tag = tagged_contents.tag.clone();
@ -205,6 +203,7 @@ impl Iterator for InternalIterator {
.. ..
})) => { })) => {
self.context.error(err); self.context.error(err);
return None;
} }
Ok(ReturnSuccess::Value(v)) => return Some(v), Ok(ReturnSuccess::Value(v)) => return Some(v),