Merge pull request #3084 from thierrymarianne/set_stream

Prevent top-level from panicking when calling  `set_input/1` with `Stream` variants.
This commit is contained in:
Mark Thom
2025-09-17 22:20:10 -07:00
committed by GitHub
8 changed files with 58 additions and 14 deletions

View File

@@ -6735,7 +6735,10 @@ impl Machine {
#[inline(always)]
pub(crate) fn read_query_term(&mut self) -> CallResult {
self.user_input.reset();
match self.user_input {
Stream::Byte(_) | Stream::Readline(_) => self.user_input.reset(),
_ => true,
};
set_prompt(true);
// let result = self.machine_st.read_term(self.user_input, &mut self.indices);
@@ -6747,7 +6750,10 @@ impl Machine {
match result {
Ok(()) => Ok(()),
Err(e) => {
self.user_input.reset();
match self.user_input {
Stream::Byte(_) | Stream::Readline(_) => self.user_input.reset(),
_ => true,
};
Err(e)
}
}