1
0
Fork 0

Merge pull request #369 from adriaan42/scheduler-fix-regex

scheduler: fix construction of the process name regex
This commit is contained in:
Jaroslav Škarvada 2022-03-15 00:45:24 +01:00 committed by GitHub
commit 79584b767f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -660,8 +660,9 @@ class SchedulerPlugin(base.Plugin):
sched = dict([(pid, (cmd, option, scheduler, priority, affinity, regex))
for pid, cmd in processes])
sched_all.update(sched)
regex = str(regex).replace("(", r"\(")
regex = regex.replace(")", r"\)")
# make any contained regexes non-capturing: replace "(" with "(?:",
# unless the "(" is preceded by "\" or followed by "?"
regex = re.sub(r"(?<!\\)\((?!\?)", "(?:", str(regex))
instance._sched_lookup[regex] = [scheduler, priority, affinity]
for pid, (cmd, option, scheduler, priority, affinity, regex) \
in sched_all.items():