Skip to content

Commit

Permalink
Fix compile on Windows
Browse files Browse the repository at this point in the history
Utf8Error is Unix-only. For now, there are no tests that actually
trigger this LOC anyways, so just make it panic.

The problem is our trait returns a ReadlineError which is used by the
shell to do things like interpret ^C and ^D. So we can't do something
like 1/ use `anyhow::Result` or 2/ make Err an associated type on Ui,
because the shell needs to know *something* about the type of Error.

This can be fixed, but we'll need another layer of abstraction. For now,
I just wanted to fix the build.
  • Loading branch information
marcbowes committed Mar 16, 2021
1 parent 81ee50b commit cbff665
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/ui.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ pub mod testing {
fn user_input(&self) -> Result<String, ReadlineError> {
let mut inner = self.inner.borrow_mut();
if inner.pending.is_empty() {
return Err(ReadlineError::Utf8Error);
panic!("mock is not ready for user input");
}
let remaining = inner.pending.split_off(1);
let first = inner.pending.pop().unwrap();
Expand Down

0 comments on commit cbff665

Please sign in to comment.