`third-party-licenses` fails on Windows when the parent process is PowerShell
Les mainteneurs répondent en général sous 1 jour
Personne n'a encore pris cette issue.
Évaluation
- Difficulté
- 2/5
- Temps estimé
- 1-3 heures
- Accessibilité débutants
- 76/100
- Type d'issue
- Bug
- Clarté
- Clairement spécifiée
- Activité
- Active
- Stack technique
- powershell, rust
- Domaine
- build-system, tooling
Piste de recherche
Commencez dans tools/third-party-licenses/src/cargo.rs, en particulier dans run(), et suivez la manière dont cargo about est invoqué et dont sa sortie est analysée. Exécutez la commande de reproduction depuis PowerShell ; le travail est terminé lorsque le JSON des licences est lu avec succès et que l’outil fonctionne lorsque PowerShell est un processus ancêtre.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Description
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
- Langage dominant
- Rust
- Étoiles
- 27.6k
- Forks
- 1.3k
- Merge moyen
- 22 h 50 min
- PR mergées (30 j)
- 143
Préparer son environnement
Lance le conteneur de développement du projet dans votre navigateur, avec votre propre compte GitHub.
- Aucun Dockerfile ni fichier Docker Compose
- Propose un modèle de pull request
- Aucun guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de GraphiteEditor/Graphite
-
Resizing a text box by one edge handle incorrectly locks both Max Width and Max Height, silently clipping textPeut-être pris @GuTS805 l’a pris il y a 68 jours. Ouverte
Difficulté 2/5 1-3 heures Accessibilité débutants 78/100
GraphiteEditor/Graphite#4396 · 2 commentaires ·
Les mainteneurs répondent en général sous 1 jour
-
Type hint is selected in node graph viewPeut-être à nouveau libre Une pull request pour cette issue a été fermée sans être fusionnée. Ouverte
Difficulté 2/5 1-3 heures Accessibilité débutants 76/100
GraphiteEditor/Graphite#4311 ·
Les mainteneurs répondent en général sous 1 jour
-
`cargo run` fails on WebAssembly target due to `CARGO_BUILD_TARGET` leaking into `rustc_codegen_spirv` buildPeut-être à nouveau libre Une pull request pour cette issue a été fermée sans être fusionnée. Ouverte
Difficulté 2/5 1-3 heures Accessibilité débutants 68/100
GraphiteEditor/Graphite#3939 · 2 commentaires · 1 réaction ·
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 5/5 Plus d'une semaine Accessibilité débutants 35/100
GraphiteEditor/Graphite#4750 ·
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 4/5 3-5 jours Accessibilité débutants 38/100
GraphiteEditor/Graphite#4748 ·
Les mainteneurs répondent en général sous 1 jour
Toutes les issues de GraphiteEditor/Graphite
Issues similaires
-
Difficulté 1/5 Moins d'une heure Accessibilité débutants 82/100
521xueweihan/HelloGitHub#4023 ·
-
Difficulté 2/5 1-3 heures Accessibilité débutants 68/100
nautechsystems/nautilus_trader#5365 ·
Les mainteneurs répondent en général sous 1 jour
-
documentation
Difficulté 2/5 1-3 heures Accessibilité débutants 78/100
IntersectMBO/developer-experience#347 ·
Les mainteneurs répondent en général sous 2 jours
-
Difficulté 2/5 1-3 heures Accessibilité débutants 78/100
registrystack/registry-stack#2168 ·
Les mainteneurs répondent en général sous 1 jour
-
bug crate: 3d help wanted triage
Difficulté 2/5 1-3 heures Accessibilité débutants 78/100
kornia/kornia-rs#1203 · 1 commentaire ·
Les mainteneurs répondent en général sous 1 jour