github / github/copilot-cli

Copilot CLI uses Unix-only commands on Windows

未關閉
#2,981 0 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視
area:platform-windows area:tools
主要語言
Shell
星號
11.2k
分支
1.9k
平均合併
14 小時 16 分鐘
30 天內合併 PR
6

描述

### Describe the bug

While running on Windows PowerShell, Copilot piped output to `head -900`, a Unix command that does not exist in PowerShell. The command failed with: "The term 'head' is not recognized as a name of a cmdlet, function, script file, or executable program." Copilot had access to the environment context indicating Windows_NT as the OS, yet still generated a Unix-style command. The equivalent PowerShell would be `Select-Object -First 900`

### Affected version

GitHub Copilot CLI 1.0.36

### Steps to reproduce the behavior

Repro Steps:
1. Open Copilot CLI on a Windows machine running PowerShell 7
2. Provide a task that involves processing a large file (e.g., a 1.8MB
JSON file over 150 records
3. Ask Copilot to extract and display a subset of the data
4. Observe the generated shell command.

### Expected behavior

Copilot should detect the OS, Windows_NT is provided in environment, and use PowerShell commands. For example, to limit output to 900 lines, it should something along the lines of: `| Select-Object -First 900`

Instead, Copilot generated the command: `python -c "..." 2>&1 | head -900`

This failed with:"The term 'head' is not recognized as a name of a cmdlet, function, script file, or executable program."

### Additional context

_No response_

貢獻指南

開啟貢獻指南

研究方向

Start at the Copilot CLI command-generation entry point and reproduce the reported task in Windows PowerShell 7. Check how the Windows_NT environment context influences generated shell commands. Done means commands requiring output limiting use a PowerShell-compatible approach instead of `head`, with the reported reproduction no longer failing.

由索引模型根據 Issue 內容生成。

評估

技術堆疊
powershell, shell
領域
cli, operating-systems
Issue 類型
缺陷
難度
4/5
預估耗時
3-5 天
活躍度
冷清
描述清晰度
基本清楚
新手友好度
45/100

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。