diff --git a/src/bub/builtin/shell_manager.py b/src/bub/builtin/shell_manager.py index 3471d65d..4a3698f9 100644 --- a/src/bub/builtin/shell_manager.py +++ b/src/bub/builtin/shell_manager.py @@ -31,6 +31,8 @@ def status(self) -> str: class ShellManager: + SHELL = shutil.which("bash") or shutil.which("sh") if os.name != "nt" else None + def __init__(self) -> None: self._shells: dict[str, ManagedShell] = {} @@ -40,7 +42,7 @@ async def start(self, *, cmd: str, cwd: str | None) -> ManagedShell: cwd=cwd, stdout=asyncio.subprocess.PIPE, stderr=asyncio.subprocess.PIPE, - executable=(shutil.which("bash") or shutil.which("sh")) if os.name != "nt" else None, + executable=self.SHELL, ) shell = ManagedShell(shell_id=f"bash-{uuid.uuid4().hex[:8]}", cmd=cmd, cwd=cwd, process=process) shell.read_tasks.extend([