Implements option --time-limit (#5502)

This commit is contained in:
Miroslav Stampar
2023-09-28 20:34:52 +02:00
parent c629374858
commit e0ec2fcdbd
6 changed files with 16 additions and 3 deletions

View File

@@ -16,6 +16,7 @@ import codecs
import json
import re
import sys
import time
from lib.core.bigarray import BigArray
from lib.core.compat import xrange
@@ -334,6 +335,10 @@ def getUnicode(value, encoding=None, noneToNull=False):
True
"""
# Best position for --time-limit mechanism
if conf.get("timeLimit") and kb.get("startTime") and (time.time() - kb.startTime > conf.timeLimit):
raise SystemExit
if noneToNull and value is None:
return NULL