Skip to content

Commit 73df07d

Browse files
authored
fix: refactor shell executable assignment to use class constant (#168)
Signed-off-by: Frost Ming <me@frostming.com>
1 parent 91a9086 commit 73df07d

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

src/bub/builtin/shell_manager.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ def status(self) -> str:
3131

3232

3333
class ShellManager:
34+
SHELL = shutil.which("bash") or shutil.which("sh") if os.name != "nt" else None
35+
3436
def __init__(self) -> None:
3537
self._shells: dict[str, ManagedShell] = {}
3638

@@ -40,7 +42,7 @@ async def start(self, *, cmd: str, cwd: str | None) -> ManagedShell:
4042
cwd=cwd,
4143
stdout=asyncio.subprocess.PIPE,
4244
stderr=asyncio.subprocess.PIPE,
43-
executable=(shutil.which("bash") or shutil.which("sh")) if os.name != "nt" else None,
45+
executable=self.SHELL,
4446
)
4547
shell = ManagedShell(shell_id=f"bash-{uuid.uuid4().hex[:8]}", cmd=cmd, cwd=cwd, process=process)
4648
shell.read_tasks.extend([

0 commit comments

Comments
 (0)