Make sure bogus interval is catched

This commit is contained in:
Orsiris de Jong 2023-02-02 10:48:12 +01:00
parent 9da3db199e
commit 3d12b669e1

View file

@ -7,7 +7,7 @@ __intname__ = "npbackup.windows.task"
__author__ = "Orsiris de Jong"
__copyright__ = "Copyright (C) 2022-2023 NetInvent"
__license__ = "GPL-3.0-only"
__build__ = "2023012101"
__build__ = "2023020201"
import sys
@ -38,6 +38,12 @@ def create_scheduled_task(executable_path, interval_minutes: int):
logger.error("Can only create a scheduled task on Windows")
return False
try:
interval_minutes = int(interval_minutes)
except ValueError:
logger.error("Bogus interval given")
return False
executable_dir = os.path.dirname(executable_path)
SCHEDULED_TASK_FILE_CONTENT = """<?xml version="1.0" encoding="UTF-16"?>