Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ProcessBuilder Allow Use of raw_arg for Command on specific platforms #15179

Open
jonatino opened this issue Feb 13, 2025 · 1 comment
Open
Labels
A-cargo-api Area: cargo-the-library API and internal code issues C-bug Category: bug S-needs-info Status: Needs more info, such as a reproduction or more background for a feature request.

Comments

@jonatino
Copy link

jonatino commented Feb 13, 2025

Problem

rust-lang/rust#29494
rust-lang/rust#92939

Right now when using ProcessBuilder::exec_with_streaming, it uses the cmd.arg() method to build the Command which on Windows, does not allow us to pass in args that are in quotes (see the above issues for more information).

Steps

No response

Possible Solution(s)

It'd be nice if we could specify if an arg is "raw" or not, or have some other work around.

Notes

I'm using the cargo-quad-apk crate which uses cargo-util for executing a build command. The problem is, if your project has spaces in the name on windows, the Clink-args escape incorrectly and cause the tool to fail to resolve paths.

https://github.com/not-fl3/cargo-quad-apk/blob/8962f68/src/ops/build/compile.rs#L271C13-L271C72

Version

cargo 1.84.1 (66221abde 2024-11-19)
release: 1.84.1
commit-hash: 66221abdeca2002d318fde6efff516aab091df0e
commit-date: 2024-11-19
host: x86_64-pc-windows-msvc
libgit2: 1.8.1 (sys:0.19.0 vendored)
libcurl: 8.9.0-DEV (sys:0.4.74+curl-8.9.0 vendored ssl:Schannel)
os: Windows 10.0.26100 (Windows 11 Professional) [64-bit]
@jonatino jonatino added C-bug Category: bug S-triage Status: This issue is waiting on initial triage. labels Feb 13, 2025
@weihanglo weihanglo added the A-cargo-api Area: cargo-the-library API and internal code issues label Feb 13, 2025
@weihanglo
Copy link
Member

Thanks for the proposal. However, does switching to raw_arg really help? It seems not to me accoriding to this rust-lang/rust#30947, as it might be an issue of how rustc parses link-args. It would be good if you can try patching cargo-util and see if it works.

Also note that, as cargo-util is not an intentional artifact released by the Cargo team, there is no guarantee any API won't be removed in the future.

@weihanglo weihanglo added S-needs-info Status: Needs more info, such as a reproduction or more background for a feature request. and removed S-triage Status: This issue is waiting on initial triage. labels Feb 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-cargo-api Area: cargo-the-library API and internal code issues C-bug Category: bug S-needs-info Status: Needs more info, such as a reproduction or more background for a feature request.
Projects
None yet
Development

No branches or pull requests

2 participants