mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Merge branch 'xMAC94x/remove_busy_waiting' into 'master'
detect EOL on stdin and no longer try to read commands. See merge request veloren/veloren!1369
This commit is contained in:
commit
4bd41ddd9c
@ -119,10 +119,7 @@ fn main() -> io::Result<()> {
|
|||||||
break;
|
break;
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
Err(e) => match e {
|
Err(mpsc::TryRecvError::Empty) | Err(mpsc::TryRecvError::Disconnected) => {},
|
||||||
mpsc::TryRecvError::Empty => {},
|
|
||||||
mpsc::TryRecvError::Disconnected => panic!(),
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// Wait for the next tick.
|
// Wait for the next tick.
|
||||||
|
@ -118,10 +118,24 @@ impl Tui {
|
|||||||
while running.load(Ordering::Relaxed) {
|
while running.load(Ordering::Relaxed) {
|
||||||
let mut line = String::new();
|
let mut line = String::new();
|
||||||
|
|
||||||
io::stdin().read_line(&mut line).unwrap();
|
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");
|
debug!(?line, "basic mode: command entered");
|
||||||
|
|
||||||
parse_command(&line, &mut msg_s);
|
parse_command(&line, &mut msg_s);
|
||||||
|
},
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user