Do not use UNIX signals in Windows

This patch does not use the signals in Windows. just avoid these calls.

This patch is related to issue #37, issue 3.
This commit is contained in:
Rodolfo García Peñas (kix) 2021-07-25 12:42:16 +02:00
parent 09fc0ece61
commit 33f3b4b1aa

View File

@ -26,6 +26,7 @@ import collections
from optparse import OptionParser from optparse import OptionParser
import offlineimap import offlineimap
from offlineimap.utils.distro_utils import get_os_name
import imaplib2 as imaplib import imaplib2 as imaplib
# Ensure that `ui` gets loaded before `threadutil` in order to # Ensure that `ui` gets loaded before `threadutil` in order to
@ -457,13 +458,16 @@ class OfflineImap:
try: try:
self.num_sigterm = 0 self.num_sigterm = 0
signal.signal(signal.SIGHUP, sig_handler)
signal.signal(signal.SIGUSR1, sig_handler) # We cannot use signals in Windows
signal.signal(signal.SIGUSR2, sig_handler) if get_os_name() != 'windows':
signal.signal(signal.SIGABRT, sig_handler) signal.signal(signal.SIGHUP, sig_handler)
signal.signal(signal.SIGTERM, sig_handler) signal.signal(signal.SIGUSR1, sig_handler)
signal.signal(signal.SIGINT, sig_handler) signal.signal(signal.SIGUSR2, sig_handler)
signal.signal(signal.SIGQUIT, sig_handler) signal.signal(signal.SIGABRT, sig_handler)
signal.signal(signal.SIGTERM, sig_handler)
signal.signal(signal.SIGINT, sig_handler)
signal.signal(signal.SIGQUIT, sig_handler)
# Various initializations that need to be performed: # Various initializations that need to be performed:
activeaccounts = self._get_activeaccounts(options) activeaccounts = self._get_activeaccounts(options)