Skip to content

Commit b3a2e40

Browse files
authored
Merge pull request #23764 from compnerd/regexes-can-solve-everything
utils: be more flexible about path separators
2 parents 48f3c45 + 95678d9 commit b3a2e40

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

utils/PathSanitizingFileCheck

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
from __future__ import print_function
1313

1414
import argparse
15+
import re
1516
import subprocess
1617
import sys
1718

@@ -47,7 +48,7 @@ constants.""")
4748
stdin = sys.stdin.read()
4849
for s in args.sanitize_strings:
4950
replacement, pattern = s.split('=', 1)
50-
stdin = stdin.replace(pattern, replacement)
51+
stdin = re.sub(re.sub(r'/', r'[/\\\\]', pattern), replacement, stdin)
5152

5253
p = subprocess.Popen(
5354
[args.file_check_path] + unknown_args, stdin=subprocess.PIPE)

0 commit comments

Comments
 (0)