don't panic if readline lib fails to initialize
fixes startup crash on non-standard TTYs
This commit is contained in:
parent
99123a15ef
commit
a7da14c109
1 changed files with 6 additions and 3 deletions
|
@ -25,9 +25,9 @@ pub struct ServerState {
|
||||||
async fn main() -> Result<(), Box<dyn Error>> {
|
async fn main() -> Result<(), Box<dyn Error>> {
|
||||||
splash::print("GameServer");
|
splash::print("GameServer");
|
||||||
|
|
||||||
let (rl, out) = Readline::new(String::from(">> ")).unwrap();
|
let rl = Readline::new(String::from(">> ")).ok();
|
||||||
|
init_tracing(rl.as_ref().map(|(_, out)| out.clone()));
|
||||||
|
|
||||||
init_tracing(Some(out.clone()));
|
|
||||||
tracing::info!("don't forget to visit https://discord.xeondev.com/");
|
tracing::info!("don't forget to visit https://discord.xeondev.com/");
|
||||||
|
|
||||||
let config = load_or_create_config::<NapGSConfig>("nap_gameserver.toml");
|
let config = load_or_create_config::<NapGSConfig>("nap_gameserver.toml");
|
||||||
|
@ -44,7 +44,10 @@ async fn main() -> Result<(), Box<dyn Error>> {
|
||||||
});
|
});
|
||||||
|
|
||||||
let command_mgr = CommandManager::new(state.clone());
|
let command_mgr = CommandManager::new(state.clone());
|
||||||
|
|
||||||
|
if let Some((rl, out)) = rl {
|
||||||
tokio::spawn(async move { command_mgr.run(rl, out).await });
|
tokio::spawn(async move { command_mgr.run(rl, out).await });
|
||||||
|
}
|
||||||
|
|
||||||
net::listen(state).await
|
net::listen(state).await
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue