From b38d825921ac20d9f6543c23ed3bc0a44a0bdf2d Mon Sep 17 00:00:00 2001 From: Liu Wei Date: Tue, 29 Aug 2017 17:32:08 +0100 Subject: Implement options to not start the config_monitor thread (#689) Provide a command line option as well as a configuration file option. The command line option takes precedence. --- src/main.rs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'src/main.rs') diff --git a/src/main.rs b/src/main.rs index 472e4144..b8b82914 100644 --- a/src/main.rs +++ b/src/main.rs @@ -148,8 +148,15 @@ fn run(mut config: Config, options: cli::Options) -> Result<(), Box> { // // The monitor watches the config file for changes and reloads it. Pending // config changes are processed in the main loop. - let config_monitor = config.path() - .map(|path| config::Monitor::new(path, display.notifier())); + let config_monitor = match (options.live_config_reload, config.live_config_reload()) { + // Start monitor if CLI flag says yes + (Some(true), _) | + // Or if no CLI flag was passed and the config says yes + (None, true) => config.path() + .map(|path| config::Monitor::new(path, display.notifier())), + // Otherwise, don't start the monitor + _ => None, + }; // Kick off the I/O thread let io_thread = event_loop.spawn(None); -- cgit v1.2.3-54-g00ecf