mirror of
https://git.notmuchmail.org/git/notmuch
synced 2024-11-21 18:38:08 +01:00
notmuch new: Don't prevent database upgrade from being interrupted.
Our signal handler is designed to quickly flush out changes and then exit. But if a database upgrade is in progress when the user interrupts, then we just want to immediately abort. We could do something fancy like add a return value to our progress_notify function to allow it to tell the upgrade process to abort. But it's actually much cleaner and robust to delay the installation of our signal handler so that the default abort happens on SIGINT.
This commit is contained in:
parent
1c86b48329
commit
c485c51585
1 changed files with 9 additions and 7 deletions
|
@ -711,13 +711,6 @@ notmuch_new_command (void *ctx, int argc, char *argv[])
|
|||
}
|
||||
}
|
||||
|
||||
/* Setup our handler for SIGINT */
|
||||
memset (&action, 0, sizeof (struct sigaction));
|
||||
action.sa_handler = handle_sigint;
|
||||
sigemptyset (&action.sa_mask);
|
||||
action.sa_flags = SA_RESTART;
|
||||
sigaction (SIGINT, &action, NULL);
|
||||
|
||||
config = notmuch_config_open (ctx, NULL, NULL);
|
||||
if (config == NULL)
|
||||
return 1;
|
||||
|
@ -758,6 +751,15 @@ notmuch_new_command (void *ctx, int argc, char *argv[])
|
|||
if (notmuch == NULL)
|
||||
return 1;
|
||||
|
||||
/* Setup our handler for SIGINT. We do this after having
|
||||
* potentially done a database upgrade we this interrupt handler
|
||||
* won't support. */
|
||||
memset (&action, 0, sizeof (struct sigaction));
|
||||
action.sa_handler = handle_sigint;
|
||||
sigemptyset (&action.sa_mask);
|
||||
action.sa_flags = SA_RESTART;
|
||||
sigaction (SIGINT, &action, NULL);
|
||||
|
||||
talloc_free (dot_notmuch_path);
|
||||
dot_notmuch_path = NULL;
|
||||
|
||||
|
|
Loading…
Reference in a new issue