mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
detect EOL on stdin and no longer try to read commands.
This can be locally tested with CTRL+D on basic mode. RUST_LOG=trace might help
This commit is contained in:
parent
a531aeca13
commit
4cf86c725e
@ -119,10 +119,7 @@ fn main() -> io::Result<()> {
|
||||
break;
|
||||
},
|
||||
},
|
||||
Err(e) => match e {
|
||||
mpsc::TryRecvError::Empty => {},
|
||||
mpsc::TryRecvError::Disconnected => panic!(),
|
||||
},
|
||||
Err(mpsc::TryRecvError::Empty) | Err(mpsc::TryRecvError::Disconnected) => {},
|
||||
};
|
||||
|
||||
// Wait for the next tick.
|
||||
|
@ -118,10 +118,24 @@ impl Tui {
|
||||
while running.load(Ordering::Relaxed) {
|
||||
let mut line = String::new();
|
||||
|
||||
io::stdin().read_line(&mut line).unwrap();
|
||||
debug!(?line, "basic mode: command entered");
|
||||
|
||||
parse_command(&line, &mut msg_s);
|
||||
match io::stdin().read_line(&mut line) {
|
||||
Err(e) => {
|
||||
error!(
|
||||
?e,
|
||||
"couldn't read from stdin, cli commands are disabled now!"
|
||||
);
|
||||
break;
|
||||
},
|
||||
Ok(0) => {
|
||||
//Docker seem to send EOL all the time
|
||||
warn!("EOL recieved, cli commands are disabled now!");
|
||||
break;
|
||||
},
|
||||
Ok(_) => {
|
||||
debug!(?line, "basic mode: command entered");
|
||||
parse_command(&line, &mut msg_s);
|
||||
},
|
||||
}
|
||||
}
|
||||
});
|
||||
} else {
|
||||
|
Loading…
Reference in New Issue
Block a user