Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/kimi_cli/utils/environment.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from __future__ import annotations

import os
import platform
from dataclasses import dataclass
from typing import Literal
Expand Down Expand Up @@ -32,7 +33,10 @@ async def detect() -> Environment:

if os_kind == "Windows":
shell_name = "Windows PowerShell"
shell_path = KaosPath("powershell.exe")
system_root = os.environ.get("SystemRoot", r"C:\Windows")
shell_path = KaosPath(
os.path.join(system_root, "System32", "WindowsPowerShell", "v1.0", "powershell.exe")
)
else:
possible_paths = [
KaosPath("/bin/bash"),
Expand Down
3 changes: 2 additions & 1 deletion tests/utils/test_utils_environment.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ async def test_environment_detection_windows(monkeypatch):
monkeypatch.setattr(platform, "system", lambda: "Windows")
monkeypatch.setattr(platform, "machine", lambda: "AMD64")
monkeypatch.setattr(platform, "version", lambda: "10.0.19044")
monkeypatch.setenv("SystemRoot", r"C:\Windows")

from kimi_cli.utils.environment import Environment

Expand All @@ -38,4 +39,4 @@ async def test_environment_detection_windows(monkeypatch):
assert env.os_arch == "AMD64"
assert env.os_version == "10.0.19044"
assert env.shell_name == "Windows PowerShell"
assert str(env.shell_path) == "powershell.exe"
assert str(env.shell_path) == r"C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe"