`third-party-licenses` fails on Windows when the parent process is PowerShell
Mantenedores costumam responder em até 1 dia
Ninguém assumiu esta issue ainda.
Avaliação
- Dificuldade
- 2/5
- Tempo estimado
- 1-3 horas
- Facilidade para iniciantes
- 76/100
- Tipo de issue
- Bug
- Clareza
- Claramente especificada
- Status de atividade
- Ativa
- Stack de tecnologia
- powershell, rust
- Domínio
- build-system, tooling
Direção de pesquisa
Comece em tools/third-party-licenses/src/cargo.rs, especialmente em run(), e acompanhe como ele invoca cargo about e analisa a saída. Execute o comando de reprodução pelo PowerShell; considera-se concluído quando o JSON de licenças é lido com sucesso e a ferramenta funciona quando o PowerShell é um processo ancestral.
Escrita pelo modelo de indexação a partir do texto da issue.
Descrição
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
- Linguagem predominante
- Rust
- Estrelas
- 27.6k
- Forks
- 1.3k
- Merge médio
- 22h 50min
- PRs com merge (30d)
- 143
Preparar o ambiente
Inicia o contêiner de desenvolvimento do projeto no navegador, com a sua própria conta do GitHub.
- Sem Dockerfile nem arquivo Docker Compose
- Tem um modelo de pull request
- Sem guia de contribuição
Primeiros passos
- Leia a issue inteira e depois o guia de contribuição do projeto.
- Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
- Faça um fork do repositório e trabalhe em uma branch.
- Abra um pull request que referencie o número da issue.
Mais de GraphiteEditor/Graphite
-
Resizing a text box by one edge handle incorrectly locks both Max Width and Max Height, silently clipping textTalvez já em andamento @GuTS805 assumiu há 68 dias. Aberta
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 78/100
GraphiteEditor/Graphite#4396 · 2 comentários ·
Mantenedores costumam responder em até 1 dia
-
Type hint is selected in node graph viewTalvez livre de novo Um pull request para esta issue foi fechado sem ser mesclado. Aberta
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 76/100
GraphiteEditor/Graphite#4311 ·
Mantenedores costumam responder em até 1 dia
-
`cargo run` fails on WebAssembly target due to `CARGO_BUILD_TARGET` leaking into `rustc_codegen_spirv` buildTalvez livre de novo Um pull request para esta issue foi fechado sem ser mesclado. Aberta
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 68/100
GraphiteEditor/Graphite#3939 · 2 comentários · 1 reação ·
Mantenedores costumam responder em até 1 dia
-
Dificuldade 5/5 Mais de uma semana Facilidade para iniciantes 35/100
GraphiteEditor/Graphite#4750 ·
Mantenedores costumam responder em até 1 dia
-
Dificuldade 4/5 3-5 dias Facilidade para iniciantes 38/100
GraphiteEditor/Graphite#4748 ·
Mantenedores costumam responder em até 1 dia
Todas as issues de GraphiteEditor/Graphite
Issues semelhantes
-
area:gc-repack-output bug factory:dogfood factory:triaged priority:p3 type:bug type:ux
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 72/100
gitbutlerapp/grit#1161 · 1 comentário ·
Mantenedores costumam responder em até 1 dia
-
bug
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 76/100
Mantenedores costumam responder em até 1 dia
-
feature
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 85/100
-
priority: low
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 68/100
storytold/photocraft#7520 · 1 comentário ·
Mantenedores costumam responder em até 1 dia
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 62/100
Mantenedores costumam responder em até 1 dia