diff --git a/src/watchdog/__init__.py b/src/watchdog/__init__.py index 5fb73c66..26dae75b 100755 --- a/src/watchdog/__init__.py +++ b/src/watchdog/__init__.py @@ -1363,7 +1363,11 @@ def do_with_lock(function): def generate_key(): if os.path.isfile(key): - return + if os.path.getsize(key) == 0: + logging.info("Purging empty private key file") + os.remove(key) + else: + return cmd = ( "openssl genpkey -algorithm RSA -out %s -pkeyopt rsa_keygen_bits:3072" % key