Skip to content

Commit 5db1043

Browse files
author
Vladimir Kotal
committed
avoid compiling the regex too often
1 parent 1c0e24d commit 5db1043

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

opengrok-tools/src/main/python/opengrok_tools/utils/commandsequence.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,8 @@ def fill(self, retcodes, outputs, failed):
7272
class CommandSequence(CommandSequenceBase):
7373
PROJECT_SUBST = '%PROJECT%'
7474

75+
re_program = re.compile('ERROR[:]*\\s+')
76+
7577
def __init__(self, base):
7678
super().__init__(base.name, base.commands, loglevel=base.loglevel,
7779
cleanup=base.cleanup, driveon=base.driveon)
@@ -229,9 +231,8 @@ def check(self, ignore_errors):
229231
self.logger.error(out)
230232
self.logger.error("")
231233

232-
re_program = re.compile('ERROR[:]*\\s+')
233234
errored_cmds = {k: v for k, v in self.outputs.items()
234-
if re_program.match(str(v))}
235+
if self.re_program.match(str(v))}
235236
if len(errored_cmds) > 0:
236237
ret = 1
237238
self.logger.error("Command output in project '{}'"

0 commit comments

Comments
 (0)