mirror of
https://github.com/abraunegg/onedrive
synced 2024-06-04 15:02:25 +02:00
Fix unhandled monitor initialisation exception
* Catch MonitorException when initialisation failure occurs, print error and exit ... cant enter monitor loop if we cant initialise correctly.
This commit is contained in:
parent
fec892b038
commit
e1be2b1e55
14
src/main.d
14
src/main.d
|
@ -671,8 +671,17 @@ int main(string[] args)
|
|||
signal(SIGINT, &exitHandler);
|
||||
signal(SIGTERM, &exitHandler);
|
||||
|
||||
// initialise the monitor class
|
||||
if (!cfg.getValueBool("download_only")) m.init(cfg, cfg.getValueLong("verbose") > 0, cfg.getValueBool("skip_symlinks"), cfg.getValueBool("check_nosync"));
|
||||
// attempt to initialise monitor class
|
||||
try {
|
||||
m.init(cfg, cfg.getValueLong("verbose") > 0, cfg.getValueBool("skip_symlinks"), cfg.getValueBool("check_nosync"));
|
||||
} catch (MonitorException e) {
|
||||
// monitor initialisation failed
|
||||
log.error("ERROR: ", e.msg);
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
//if (!cfg.getValueBool("download_only")) m.init(cfg, cfg.getValueLong("verbose") > 0, cfg.getValueBool("skip_symlinks"), cfg.getValueBool("check_nosync"));
|
||||
if (!cfg.getValueBool("download_only")) {
|
||||
// monitor loop
|
||||
immutable auto checkInterval = dur!"seconds"(cfg.getValueLong("monitor_interval"));
|
||||
immutable auto logInterval = cfg.getValueLong("monitor_log_frequency");
|
||||
|
@ -740,6 +749,7 @@ int main(string[] args)
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Workaround for segfault in std.net.curl.Curl.shutdown() on exit
|
||||
oneDrive.http.shutdown();
|
||||
|
|
Loading…
Reference in a new issue