don't throw runtime error when stdin closes
This commit is contained in:
parent
dce22d5719
commit
3facaa10a2
|
@ -7,10 +7,6 @@ fn main() {
|
|||
)
|
||||
);
|
||||
if eval.is_err() {
|
||||
let err = eval.unwrap_err();
|
||||
if err == "Stdin closed" {
|
||||
return
|
||||
}
|
||||
eprintln!("Program failed: {}", err);
|
||||
eprintln!("Program failed: \n{}", eval.unwrap_err());
|
||||
}
|
||||
}
|
|
@ -119,7 +119,7 @@ pub fn eval_mem(bf_str: &&str, mem: &mut [u8], pointer: &mut usize) -> Result<()
|
|||
if char == ',' {
|
||||
let byte = stdin().bytes().next();
|
||||
if byte.is_none() {
|
||||
return Err("Stdin closed".into());
|
||||
continue
|
||||
}
|
||||
let byte = byte.unwrap();
|
||||
if byte.is_err() {
|
||||
|
|
Loading…
Reference in New Issue