fix: stdin conflicts

This commit is contained in:
Timothy Zhang
2026-03-04 14:45:02 -08:00
parent a98a4ca0b6
commit 199cb3d8cc
4 changed files with 23 additions and 8 deletions
@@ -2898,6 +2898,7 @@ def run_tests(
text=True,
timeout=600, # 10 minute timeout
env=env,
stdin=subprocess.DEVNULL,
)
except subprocess.TimeoutExpired:
return json.dumps(
@@ -3089,6 +3090,7 @@ def debug_test(
text=True,
timeout=120, # 2 minute timeout for single test
env=env,
stdin=subprocess.DEVNULL,
)
except subprocess.TimeoutExpired:
return json.dumps(
+15 -6
View File
@@ -130,8 +130,8 @@ function Test-DefenderExclusions {
# Normalize and filter null/empty values
$safePrefixes = $safePrefixes | Where-Object { $_ } | ForEach-Object {
[System.IO.Path]::GetFullPath($_)
}
try { [System.IO.Path]::GetFullPath($_) } catch { $null }
} | Where-Object { $_ }
try {
# Check if Defender cmdlets are available (may not exist on older Windows)
@@ -157,15 +157,20 @@ function Test-DefenderExclusions {
$existing = $prefs.ExclusionPath
if (-not $existing) { $existing = @() }
# Normalize existing paths for comparison
# Normalize existing paths for comparison (some may contain wildcards
# or env vars that GetFullPath rejects — skip those gracefully)
$existing = $existing | Where-Object { $_ } | ForEach-Object {
[System.IO.Path]::GetFullPath($_)
try { [System.IO.Path]::GetFullPath($_) } catch { $_ }
}
# Normalize paths and find missing exclusions
$missing = @()
foreach ($path in $Paths) {
$normalized = [System.IO.Path]::GetFullPath($path)
try {
$normalized = [System.IO.Path]::GetFullPath($path)
} catch {
continue # Skip paths with unsupported format
}
# Security: Ensure path is within safe boundaries
$isSafe = $false
@@ -250,7 +255,11 @@ function Add-DefenderExclusions {
foreach ($path in $Paths) {
try {
$normalized = [System.IO.Path]::GetFullPath($path)
try {
$normalized = [System.IO.Path]::GetFullPath($path)
} catch {
$normalized = $path # Use raw path if normalization fails
}
Add-MpPreference -ExclusionPath $normalized -ErrorAction Stop
$added += $normalized
} catch {
+5 -1
View File
@@ -131,7 +131,7 @@ def _resolve_path(path: str) -> str:
def _snapshot_git(*args: str) -> str:
"""Run a git command with the snapshot GIT_DIR and PROJECT_ROOT worktree."""
cmd = ["git", "--git-dir", SNAPSHOT_DIR, "--work-tree", PROJECT_ROOT, *args]
result = subprocess.run(cmd, capture_output=True, text=True, timeout=30)
result = subprocess.run(cmd, capture_output=True, text=True, timeout=30, stdin=subprocess.DEVNULL)
return result.stdout.strip()
@@ -145,6 +145,7 @@ def _ensure_snapshot_repo():
["git", "init", "--bare", SNAPSHOT_DIR],
capture_output=True,
timeout=10,
stdin=subprocess.DEVNULL,
)
_snapshot_git("config", "core.autocrlf", "false")
@@ -225,6 +226,7 @@ def run_command(command: str, cwd: str = "", timeout: int = 120) -> str:
capture_output=True,
text=True,
timeout=timeout,
stdin=subprocess.DEVNULL,
env={
**os.environ,
"PYTHONPATH": os.pathsep.join(
@@ -304,6 +306,7 @@ def undo_changes(path: str = "") -> str:
capture_output=True,
text=True,
timeout=10,
stdin=subprocess.DEVNULL,
)
return f"Restored: {path}"
else:
@@ -1108,6 +1111,7 @@ def run_agent_tests(
text=True,
timeout=120,
env=env,
stdin=subprocess.DEVNULL,
)
except subprocess.TimeoutExpired:
return json.dumps(
+1 -1
View File
@@ -513,7 +513,7 @@ def register_file_tools(
cmd.extend(["--glob", include])
cmd.append(resolved)
rg_result = subprocess.run(cmd, capture_output=True, text=True, timeout=30)
rg_result = subprocess.run(cmd, capture_output=True, text=True, timeout=30, stdin=subprocess.DEVNULL)
if rg_result.returncode <= 1:
output = rg_result.stdout.strip()
if not output: