Doing final pass of adjustments with anythingllm

This commit is contained in:
2026-02-22 09:54:36 -05:00
parent 34ed257cd6
commit 254ca8cbda
5 changed files with 77 additions and 31 deletions

View File

@@ -10,7 +10,8 @@ def run_powershell(script: str, base_dir: str) -> str:
Returns a string combining stdout, stderr, and exit code.
Raises nothing - all errors are captured into the return string.
"""
full_script = f"Set-Location -LiteralPath '{base_dir}'\n{script}"
safe_dir = str(base_dir).replace("'", "''")
full_script = f"Set-Location -LiteralPath '{safe_dir}'\n{script}"
# Try common executable names
exe = next((x for x in ["powershell.exe", "pwsh.exe", "powershell", "pwsh"] if shutil.which(x)), None)
if not exe: return "ERROR: Neither powershell nor pwsh found in PATH"