Skip to content

Commit 8a01c3d

Browse files
jason-simmonsmboetger
authored andcommitted
Escape the forbidden strings in the regex used to check test command output (flutter#170702)
The forbidden string might be something like "[ERROR" that contains characters used in the regex syntax.
1 parent d617bde commit 8a01c3d

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

engine/src/flutter/testing/run_tests.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,8 @@ def run_cmd( # pylint: disable=too-many-arguments
131131

132132
for forbidden_string in forbidden_output:
133133
if forbidden_string in output:
134-
matches = [x.group(0) for x in re.findall(f'^.*{forbidden_string}.*$', output)]
134+
forbidden_escaped = re.escape(forbidden_string)
135+
matches = [x.group(0) for x in re.findall(f'^.*{forbidden_escaped}.*$', output)]
135136
raise RuntimeError(
136137
f'command "{command_string}" contained forbidden string "{forbidden_string}": {matches}'
137138
)

0 commit comments

Comments
 (0)