mirror of
https://github.com/abraunegg/onedrive
synced 2024-05-04 15:03:24 +02:00
Update main.d
* Correct ^C handling * Correct ^C exit value
This commit is contained in:
parent
295a734783
commit
dbe21ed903
14
src/main.d
14
src/main.d
|
@ -1406,22 +1406,14 @@ auto assumeNoGC(T) (T t) if (isFunctionPointer!T || isDelegate!T) {
|
|||
return cast(SetFunctionAttributes!(T, functionLinkage!T, attrs)) t;
|
||||
}
|
||||
|
||||
// Catch CTRL-C
|
||||
// Catch CTRL-C if user pressed this
|
||||
extern(C) nothrow @nogc @system void exitHandler(int value) {
|
||||
try {
|
||||
assumeNoGC ( () {
|
||||
addLogEntry("Got termination signal, performing clean up");
|
||||
// Force kill any running threads as ^C was used
|
||||
taskPool.finish(false);
|
||||
// Was itemDb initialised?
|
||||
if (itemDB.isDatabaseInitialised()) {
|
||||
// Make sure the .wal file is incorporated into the main db before we exit
|
||||
addLogEntry("Shutting down DB connection and merging temporary data");
|
||||
itemDB.performVacuum();
|
||||
object.destroy(itemDB);
|
||||
}
|
||||
performStandardExitProcess();
|
||||
})();
|
||||
} catch(Exception e) {}
|
||||
exit(0);
|
||||
// Exit with the exitHandler value
|
||||
exit(value);
|
||||
}
|
Loading…
Reference in a new issue