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,6 +458,9 @@ class OfflineImap:
try: try:
self.num_sigterm = 0 self.num_sigterm = 0
# We cannot use signals in Windows
if get_os_name() != 'windows':
signal.signal(signal.SIGHUP, sig_handler) signal.signal(signal.SIGHUP, sig_handler)
signal.signal(signal.SIGUSR1, sig_handler) signal.signal(signal.SIGUSR1, sig_handler)
signal.signal(signal.SIGUSR2, sig_handler) signal.signal(signal.SIGUSR2, sig_handler)