htrefil / rkvm

Virtual KVM switch for Linux machines
MIT License
386 stars 50 forks source link

race condition when starting server prevents next key release event #46

Open digitalsignalperson opened 10 months ago

digitalsignalperson commented 10 months ago

As described in this comment in #45, when pressing the Enter key to start rkvm in the terminal, the key release event may be eaten by rkvm. The effect can be weirdness with different input events and spamming of newlines in the terminal until the Enter key is pressed again to provide the missing release event.

slartibart70 commented 8 months ago

This also happens when starting the service on the commandline with systemctl. Some automatically added newlines are pushed to the open terminal

NamPNQ commented 6 months ago

From suggestion of @htrefil, I just do this for the fix

https://github.com/htrefil/rkvm/blob/e29d9895695d74d50658858fd83d9c875f5673ef/rkvm-server/src/main.rs#L28

 #[tokio::main]
 async fn main() -> ExitCode {
+    time::sleep(Duration::from_millis(100)).await;
     let filter = EnvFilter::builder()