File tree Expand file tree Collapse file tree 1 file changed +8
-1
lines changed
python/packages/autogen-ext/src/autogen_ext/code_executors Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change 11import inspect
22import re
3+ import shutil
34from dataclasses import dataclass
45from pathlib import Path
56from textwrap import dedent , indent
@@ -159,7 +160,13 @@ def lang_to_cmd(lang: str) -> str:
159160 if lang in ["shell" ]:
160161 return "sh"
161162 if lang in ["pwsh" , "powershell" , "ps1" ]:
162- return "pwsh"
163+ # Check if pwsh is available, otherwise fall back to powershell
164+ if shutil .which ("pwsh" ) is not None :
165+ return "pwsh"
166+ elif shutil .which ("powershell" ) is not None :
167+ return "powershell"
168+ else :
169+ raise ValueError (f"Powershell or pwsh is not installed. Please install one of them." )
163170 else :
164171 raise ValueError (f"Unsupported language: { lang } " )
165172
You can’t perform that action at this time.
0 commit comments