fix(core): fix bug that caused the daemon to mistakenly restart the worker on Windows and macOS

This commit is contained in:
Federico Terzi 2021-10-06 22:45:16 +02:00
parent c4070d0044
commit 8f291f4717

View File

@ -95,7 +95,13 @@ fn daemon_main(args: CliModuleArgs) -> i32 {
.expect("unable to initialize config watcher thread"); .expect("unable to initialize config watcher thread");
let (_keyboard_layout_watcher_notify, keyboard_layout_watcher_signal) = unbounded::<()>(); let (_keyboard_layout_watcher_notify, keyboard_layout_watcher_signal) = unbounded::<()>();
keyboard_layout_watcher::initialize_and_spawn(_keyboard_layout_watcher_notify)
#[allow(clippy::redundant_clone)]
// IMPORTANT: Here we clone the channel instead of simply passing it to avoid
// dropping the channel immediately on those platforms that don't support the
// layout watcher (currently Windows and macOS).
// Otherwise, the select below would always return an error because the channel is closed.
keyboard_layout_watcher::initialize_and_spawn(_keyboard_layout_watcher_notify.clone()) // DON'T REMOVE THE CLONE!
.expect("unable to initialize keyboard layout watcher thread"); .expect("unable to initialize keyboard layout watcher thread");
let config_store = let config_store =