`third-party-licenses` fails on Windows when the parent process is PowerShell
維護者通常 1 天內回覆
評估
- 難度
- 2/5
- 預估耗時
- 1-3 小時
- 新手友好度
- 76/100
- Issue 類型
- 缺陷
- 描述清晰度
- 描述清楚
- 活躍度
- 活躍
- 技術堆疊
- powershell, rust
- 領域
- build-system, tooling
研究方向
從 tools/third-party-licenses/src/cargo.rs 開始,尤其是 run(),追蹤它如何呼叫 cargo about 並解析輸出。從 PowerShell 執行重現命令;當授權 JSON 成功讀取,且 PowerShell 是祖先程序時工具能成功執行,即表示完成。
由索引模型根據 Issue 內容生成。
描述
Summary
tools/third-party-licenses runs cargo about generate --format json --locked and parses stdout. On Windows, if PowerShell appears anywhere in the parent process chain, cargo-about refuses to write JSON to stdout and exits with an error telling you to use -o / --output-file.
That breaks cargo run desktop (and any CI/agent that launches the build from PowerShell), even though cargo-about itself is installed and works when given an output file.
Environment
- OS: Windows 10/11
- Shell: PowerShell 5.1 / PowerShell 7 (also fails when an ancestor is PowerShell, e.g. Cursor/VS Code terminal,
cargo-runspawned from pwsh) cargo-about0.9.x (behavior from EmbarkStudios/cargo-about#198 / PR that addedis_powershell_parent())
Steps to reproduce
- On Windows, open PowerShell in a Graphite checkout.
- Ensure
cargo-aboutis onPATH. - Run:
cargo run -p third-party-licenses --features desktop
(or the same step via cargo run desktop)
Expected
License JSON is generated and the tool succeeds.
Actual
cargo about generate fails roughly with:
cargo-about should not redirect its output in powershell
(or similar wording pointing at -o, --output-file). Redirecting/piping from the Graphite side does not help: the check walks ancestor processes, so Command::output() capturing stdout is enough to trigger it whenever PowerShell is an ancestor.
Root cause
Current code in tools/third-party-licenses/src/cargo.rs (run()):
Command::new("cargo")
.args(["about", "generate", "--format", "json", "--locked"])
// … reads output.stdout
cargo-about intentionally blocks stdout under PowerShell (UTF-16 / encoding footgun). The supported API is writing to a file with -o.
Suggested fix
Write to a temp file with -o, then read and parse that file (delete afterward). Minimal patch:
fn run() -> Result<Output, Error> {
let out_path = std::env::temp_dir().join(format!("graphite-about-{}.json", std::process::id()));
let output = Command::new("cargo")
.args([
"about",
"generate",
"--format",
"json",
"--locked",
"-o",
out_path.to_str().ok_or_else(|| Error::Command("about output path is not UTF-8".into()))?,
])
.current_dir(env!("CARGO_WORKSPACE_DIR"))
.output()
.map_err(|e| Error::Io(e, "Failed to run cargo about generate".into()))?;
if !output.status.success() {
let _ = std::fs::remove_file(&out_path);
return Err(Error::Command(format!(
"cargo about generate failed:\n{}",
String::from_utf8_lossy(&output.stderr)
)));
}
let json = std::fs::read_to_string(&out_path).map_err(|e| Error::Io(e, format!("reading {}", out_path.display())))?;
let _ = std::fs::remove_file(&out_path);
serde_json::from_str(&json).map_err(|e| Error::Json(e, "Failed to parse cargo about generate JSON".into()))
}
This is also slightly more robust on non-Windows hosts (no reliance on capturing a large JSON blob from a pipe).
Workaround (today)
# Skip the failing step and continue the desktop bundle, or invoke about with -o manually:
cargo about generate --format json --locked -o $env:TEMP\about.json
References
- EmbarkStudios/cargo-about#198 (PowerShell / stdout encoding; led to rejecting stdout under PowerShell)
- Graphite call site:
tools/third-party-licenses/src/cargo.rs→run() - Invoked from desktop flow:
cargo run desktop→third-party-licenseswith--features desktop
- 主要語言
- Rust
- 星號
- 27.7k
- 分支
- 1.3k
- 平均合併
- 14 小時 57 分鐘
- 30 天內合併 PR
- 151
環境準備
在瀏覽器裡用你自己的 GitHub 帳號啟動這個專案的開發容器。
- 沒有 Dockerfile 或 Docker Compose 檔案
- 有 Pull Request 範本
- 沒有貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
GraphiteEditor/Graphite 的其他 Issue
-
Resizing a text box by one edge handle incorrectly locks both Max Width and Max Height, silently clipping text可能重新可做 關聯的 PR 已關閉且未合併。 未關閉
難度 2/5 1-3 小時 新手友好度 78/100
GraphiteEditor/Graphite#4396 · 2 則留言 ·
維護者通常 1 天內回覆
-
Type hint is selected in node graph view可能重新可做 關聯的 PR 已關閉且未合併。 未關閉
難度 2/5 1-3 小時 新手友好度 76/100
GraphiteEditor/Graphite#4311 ·
維護者通常 1 天內回覆
-
`cargo run` fails on WebAssembly target due to `CARGO_BUILD_TARGET` leaking into `rustc_codegen_spirv` build可能重新可做 關聯的 PR 已關閉且未合併。 未關閉
難度 2/5 1-3 小時 新手友好度 68/100
GraphiteEditor/Graphite#3939 · 2 則留言 · 1 個 reaction ·
維護者通常 1 天內回覆
-
難度 4/5 3-5 天 新手友好度 52/100
GraphiteEditor/Graphite#4833 ·
維護者通常 1 天內回覆
-
難度 4/5 3-5 天 新手友好度 43/100
GraphiteEditor/Graphite#4826 · 2 則留言 ·
維護者通常 1 天內回覆
查看 GraphiteEditor/Graphite 的全部 Issue
相似的 Issue
-
component:benchmark
難度 2/5 1-3 小時 新手友好度 76/100
agentic-os-org/ANOLISA#9177 ·
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 78/100
oracle/rust-oracledb#61 ·
-
bug priority-medium to-agent
難度 2/5 1-3 小時 新手友好度 78/100
維護者通常 1 天內回覆
-
難度 1/5 1 小時以內 新手友好度 82/100
維護者通常 2 天內回覆
-
Databricks tool-only response crashes in resolve_reasoning_and_content with KeyError: content可能已有人在做 @1divyanshdev 今天認領。 未關閉llm translation
難度 2/5 1-3 小時 新手友好度 79/100
BerriAI/litellm#48637 · 2 則留言 ·
維護者通常 1 天內回覆