mirror of
https://github.com/Pumpkin-MC/Pumpkin.git
synced 2026-08-30 20:14:23 +00:00
fix: stop stdin console task on EOF (#2524)
Co-authored-by: Whiron <15068326+dnlblasco@users.noreply.github.com>
This commit is contained in:
@@ -688,21 +688,21 @@ fn setup_stdin_console(server: Arc<Server>) {
|
||||
}
|
||||
});
|
||||
tokio::spawn(async move {
|
||||
while !SHOULD_STOP.load(Ordering::Relaxed) {
|
||||
if let Some(command) = rx.recv().await {
|
||||
let mut event = ServerCommandEvent::new(command.clone());
|
||||
server.plugin_manager.fire(&server, &mut event).await;
|
||||
if !event.cancelled {
|
||||
server
|
||||
.command_dispatcher
|
||||
.read()
|
||||
.await
|
||||
.handle_command(
|
||||
&command::CommandSender::Console.into_source(&server).await,
|
||||
command.as_str(),
|
||||
)
|
||||
.await;
|
||||
}
|
||||
while !SHOULD_STOP.load(Ordering::Relaxed)
|
||||
&& let Some(command) = rx.recv().await
|
||||
{
|
||||
let mut event = ServerCommandEvent::new(command.clone());
|
||||
server.plugin_manager.fire(&server, &mut event).await;
|
||||
if !event.cancelled {
|
||||
server
|
||||
.command_dispatcher
|
||||
.read()
|
||||
.await
|
||||
.handle_command(
|
||||
&command::CommandSender::Console.into_source(&server).await,
|
||||
command.as_str(),
|
||||
)
|
||||
.await;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user