fix: Use shlex.quote() to lint filepaths containing shell metacharacters

This commit is contained in:
Mir Adnan ALI 2025-02-04 20:32:08 -05:00
parent 674eb109c2
commit 3e8f9aa31c

View file

@ -4,6 +4,7 @@ import subprocess
import sys import sys
import traceback import traceback
import warnings import warnings
import shlex
from dataclasses import dataclass from dataclasses import dataclass
from pathlib import Path from pathlib import Path
@ -44,7 +45,7 @@ class Linter:
return fname return fname
def run_cmd(self, cmd, rel_fname, code): def run_cmd(self, cmd, rel_fname, code):
cmd += " " + rel_fname cmd += " " + shlex.quote(rel_fname)
returncode = 0 returncode = 0
stdout = "" stdout = ""