Skip to content

Commit

Permalink
Fix IPC on Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
null-dev committed Jun 25, 2021
1 parent 946efb2 commit d77b1ad
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/ipc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,13 @@ fn handle_conn(app_state: &AppState, mut conn: LocalSocketStream) {
// Read command
let mut deserializer = serde_cbor::Deserializer::from_reader(&mut conn);
match IPCCommand::deserialize(&mut deserializer) {
Ok(command) => handle_ipc_cmd(app_state, command),
Ok(command) => {
let app_state_clone = app_state.clone();
// Windows doesn't seem to like it if we block when reading from a named pipe
// So instead handle the command in a new thread to avoid doing expensive stuff
// in the IPC thread.
thread::spawn(move || handle_ipc_cmd(&app_state_clone, command));
}
Err(e) => {
log::error!("Failed to read command from IPC: {:?}", e);
return
Expand Down

0 comments on commit d77b1ad

Please sign in to comment.