mirror of
https://github.com/instructkr/claw-code.git
synced 2026-10-19 00:00:08 +08:00
perf(test): cache bash probe resolution per session with functools.lru_cache
This commit is contained in:
1 parent
0d8b50b378
commit
a916bf9d66
2 files changed
+8
-5
No files matched your search
@@ -1,3 +1,4 @@
|
||||
import functools
|
||||
import os
|
||||
import shutil
|
||||
import subprocess
|
||||
@@ -5,6 +6,7 @@ import unittest
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
@functools.lru_cache(maxsize=1)
|
||||
def get_bash_executable() -> str | None:
|
||||
if os.name == 'nt':
|
||||
for candidate in (
|
||||
@@ -21,6 +23,7 @@ def get_bash_executable() -> str | None:
|
||||
return None
|
||||
|
||||
|
||||
@functools.lru_cache(maxsize=1)
|
||||
def require_bash() -> bool:
|
||||
bash = get_bash_executable()
|
||||
if not bash:
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import functools
|
||||
import os
|
||||
import shutil
|
||||
import subprocess
|
||||
import sys
|
||||
import tempfile
|
||||
import unittest
|
||||
from pathlib import Path
|
||||
@@ -12,12 +15,8 @@ NEXT_ID = REPO_ROOT / 'scripts' / 'roadmap-next-id.sh'
|
||||
DOGFOOD_PROBE = REPO_ROOT / 'scripts' / 'dogfood-probe.py'
|
||||
|
||||
|
||||
|
||||
|
||||
import sys
|
||||
|
||||
@functools.lru_cache(maxsize=1)
|
||||
def get_bash_executable() -> str | None:
|
||||
import os
|
||||
if os.name == 'nt':
|
||||
for candidate in (
|
||||
r'C:\Program Files\Git\bin\bash.exe',
|
||||
@@ -33,6 +32,7 @@ def get_bash_executable() -> str | None:
|
||||
return None
|
||||
|
||||
|
||||
@functools.lru_cache(maxsize=1)
|
||||
def require_bash() -> bool:
|
||||
bash = get_bash_executable()
|
||||
if not bash:
|
||||
|
||||
Reference in new issue
Block a user