feat(core): wire up auto_restart option
This commit is contained in:
parent
da19664f5b
commit
c79d248812
|
@ -58,6 +58,9 @@ const VERSION: &str = env!("CARGO_PKG_VERSION");
|
||||||
|
|
||||||
fn daemon_main(args: CliModuleArgs) -> i32 {
|
fn daemon_main(args: CliModuleArgs) -> i32 {
|
||||||
let paths = args.paths.expect("missing paths in daemon main");
|
let paths = args.paths.expect("missing paths in daemon main");
|
||||||
|
let config_store = args
|
||||||
|
.config_store
|
||||||
|
.expect("missing config store in worker main");
|
||||||
|
|
||||||
// Make sure only one instance of the daemon is running
|
// Make sure only one instance of the daemon is running
|
||||||
let lock_file = acquire_daemon_lock(&paths.runtime);
|
let lock_file = acquire_daemon_lock(&paths.runtime);
|
||||||
|
@ -92,9 +95,11 @@ fn daemon_main(args: CliModuleArgs) -> i32 {
|
||||||
.expect("unable to initialize ipc server for daemon");
|
.expect("unable to initialize ipc server for daemon");
|
||||||
|
|
||||||
let (watcher_notify, watcher_signal) = unbounded::<()>();
|
let (watcher_notify, watcher_signal) = unbounded::<()>();
|
||||||
// TODO: check if "auto_restart" config option is enabled before starting it
|
|
||||||
watcher::initialize_and_spawn(&paths.config, watcher_notify)
|
if config_store.default().auto_restart() {
|
||||||
.expect("unable to initialize config watcher thread");
|
watcher::initialize_and_spawn(&paths.config, watcher_notify)
|
||||||
|
.expect("unable to initialize config watcher thread");
|
||||||
|
}
|
||||||
|
|
||||||
loop {
|
loop {
|
||||||
select! {
|
select! {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user