`third-party-licenses` fails on Windows when the parent process is PowerShell
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 76/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- powershell, rust
- Lĩnh vực
- build-system, tooling
Hướng nghiên cứu
Bắt đầu từ tools/third-party-licenses/src/cargo.rs, đặc biệt là run(), và theo dõi cách nó gọi cargo about cũng như phân tích đầu ra. Chạy lệnh tái hiện từ PowerShell; hoàn thành nghĩa là JSON giấy phép được đọc thành công và công cụ hoạt động thành công khi PowerShell là một tiến trình tổ tiên.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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
- Ngôn ngữ chính
- Rust
- Star
- 27.6k
- Fork
- 1.3k
- Merge trung bình
- 1 ngày 3 giờ
- Pull request đã merge (30 ngày)
- 145
Chuẩn bị môi trường
Khởi chạy dev container của dự án ngay trên trình duyệt, bằng tài khoản GitHub của bạn.
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Không có hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của GraphiteEditor/Graphite
-
Resizing a text box by one edge handle incorrectly locks both Max Width and Max Height, silently clipping textCó thể đã có người làm @GuTS805 đã nhận 69 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
GraphiteEditor/Graphite#4396 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Type hint is selected in node graph viewCó thể làm lại được Pull request cho issue này đã bị đóng mà không được merge. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
GraphiteEditor/Graphite#4311 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
`cargo run` fails on WebAssembly target due to `CARGO_BUILD_TARGET` leaking into `rustc_codegen_spirv` buildCó thể làm lại được Pull request cho issue này đã bị đóng mà không được merge. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
GraphiteEditor/Graphite#3939 · 2 bình luận · 1 reaction ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Self-hosting?Đang mở
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 35/100
GraphiteEditor/Graphite#4755 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 55/100
GraphiteEditor/Graphite#4752 · 1 reaction ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của GraphiteEditor/Graphite
Issue tương tự
-
ci: SHA pin 3rd party actionsĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 64/100
Maintainer thường phản hồi trong vòng 3 ngày
-
Nushell launcher failure.Đang mởbug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
-
Zellij doesn't validate hex colors correctly and crashesCó thể đã có người làm @ymcx đã nhận hôm nay. Đang mởsuspected bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
zellij-org/zellij#5732 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug(api): E_DOSE_ATTR_NONFINITE for a modeled D/R still says the value "never reaches you as a NaN"Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 63/100