refactor: compress _extract_absolute_paths comments
This commit is contained in:
@@ -153,10 +153,6 @@ class ExecTool(Tool):
|
|||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def _extract_absolute_paths(command: str) -> list[str]:
|
def _extract_absolute_paths(command: str) -> list[str]:
|
||||||
# Match Windows absolute paths without truncating at backslashes.
|
win_paths = re.findall(r"[A-Za-z]:\\[^\s\"'|><;]+", command) # Windows: C:\...
|
||||||
win_paths = re.findall(r"[A-Za-z]:\\[^\s\"'|><;]+", command)
|
posix_paths = re.findall(r"(?:^|[\s|>])(/[^\s\"'>]+)", command) # POSIX: /absolute only
|
||||||
# Only match absolute paths — avoid false positives on relative
|
|
||||||
# paths like ".venv/bin/python" where "/bin/python" would be
|
|
||||||
# incorrectly extracted by the old pattern.
|
|
||||||
posix_paths = re.findall(r"(?:^|[\s|>])(/[^\s\"'>]+)", command)
|
|
||||||
return win_paths + posix_paths
|
return win_paths + posix_paths
|
||||||
|
|||||||
Reference in New Issue
Block a user