The /copy command does not work in WSL
还没有人认领这个 Issue。
- 主要语言
- Shell
- 星标
- 11.2k
- 派生
- 1.9k
- 平均合并
- 14 小时 16 分钟
- 30 天内合并 PR
- 6
描述
Describe the bug
/copy fails under WSL2/WSLg with Failed to copy to clipboard: Error: clip.exe exited with code 1 . But echo test | clip.exe reliably works, including from the repository and with Unicode/large input. The bundled native clipboard module fails first because WSLg’s Wayland compositor lacks ext-data-control / wlr-data-control ; forcing X11 by unsetting WAYLAND_DISPLAY makes native clipboard copy work. The CLI’s clip.exe fallback appears to invoke clip.exe incorrectly, likely passing text as an argument instead of stdin.
Affected version
GitHub Copilot CLI 1.0.80.
Steps to reproduce the behavior
- Launch WSL from Windows.
- From WSL, start a copilot-cli session.
- Send copilot a prompt and wait for a response.
- Use the
/copycommand to copy the copilot response to the clipboard. - Observe the following error message:
Failed to copy to clipboard: Error: clip.exe exited with code 1
Expected behavior
No new Copilot output, but the latest Copilot response gets copied to the clipboard a.k.a. copy/paste buffer, ready to paste elsewhere.
Additional context
My actual use-case is more deeply nested than this. I'm running Kubuntu 26.04 on a laptop, then launching a Windows VDI via Citrix Workspace. I run WSL from within the Windows VDI, and GitHub Copilot from within WSL.
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
首先在 WSL2/WSLg 下复现 /copy,并将其对 clip.exe 的调用与可正常工作的命令 echo test | clip.exe 进行比较。跟踪 CLI 的剪贴板回退机制和原生剪贴板选择,然后验证最新的 Copilot 响应能够在 Unicode 和大输入下成功复制,且不会产生新的输出。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- linux, shell
- 领域
- cli, operating-systems
- Issue 类型
- 缺陷
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 活跃度
- 活跃
- 描述清晰度
- 基本清楚
- 新手友好度
- 55/100