Skip to content

Conversation

@mikeyhew
Copy link
Contributor

@mikeyhew mikeyhew commented Jun 29, 2018

cc @joshtriplett
fixes #5665

Removes the debug_string method, in favour of always using the
fmt::Display impl. debug_string didn’t escape the command
arguments, so that’s why we ended up with unescaped arguments after
compilation failed.

Don't merge this yet, because I still want to add a regression test. I don't think there's any tests on shell quoting yet, so I'll probably add a new test file including tests for the "Running " output too. I still have to figure out how to write tests, and don't have the energy to do that tonight 😴

I just wanted to say, by the way, I was pleasantly surprised with how clean the code is in this repo, especially compared to rustc. It made it really easy to find the relevant part of the code and implement these changes.

fixes rust-lang#5665

remove the `debug_string` method, in favour of always using the
`fat::Display` impl. `debug_string` didn’t escape the command
arguments, so that’s why we ended up with unescaped arguments after
compilation failed
@rust-highfive
Copy link

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @matklad (or someone else) soon.

If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes.

Please see the contribution instructions for more information.

@alexcrichton
Copy link
Member

Nice! r=me with a test

The doesn’t doesn’t seem to run when I run `cargo test` though
@alexcrichton
Copy link
Member

@bors: r+

Thanks!

@bors
Copy link
Contributor

bors commented Jul 3, 2018

📌 Commit 727684d has been approved by alexcrichton

@bors
Copy link
Contributor

bors commented Jul 3, 2018

⌛ Testing commit 727684d with merge 592b253...

bors added a commit that referenced this pull request Jul 3, 2018
[needs test] always shell-escape command arguments after failure

cc @joshtriplett
fixes #5665

Removes the `debug_string` method, in favour of always using the
`fmt::Display` impl. `debug_string` didn’t escape the command
arguments, so that’s why we ended up with unescaped arguments after
compilation failed.

Don't merge this yet, because I still want to add a regression test. I don't think there's any tests on shell quoting yet, so I'll probably add a new test file including tests for the "Running <command>" output too. I still have to figure out how to write tests, and don't have the energy to do that tonight 😴

I just wanted to say, by the way, I was pleasantly surprised with how clean the code is in this repo, especially compared to rustc. It made it really easy to find the relevant part of the code and implement these changes.
@bors
Copy link
Contributor

bors commented Jul 3, 2018

☀️ Test successful - status-appveyor, status-travis
Approved by: alexcrichton
Pushing 592b253 to master...

@bors bors merged commit 727684d into rust-lang:master Jul 3, 2018
mikeyhew added a commit to mikeyhew/cargo that referenced this pull request Jul 4, 2018
Even with rust-lang#5666, when commands are shown in verbose output, there are
still some cases where they can’t be run in the terminal. This is
because the code is expecting certain environment variables that are
provided by cargo. This PR updates the `Display` impl for
`ProcessBuilder` to show the environment variables in front of the
command (on unix), so that the command can be run. Note that for
workspaces, you will still have to run the command from the workspace
root.

I deliberately didn’t update any of the tests yet, because I want to
see if this is desired, and figure out if there is a way to do this on
windows.
bors added a commit that referenced this pull request Jul 6, 2018
Fix the shell_quoting test

r? @alexcrichton

add-on to #5666
- Added `mod shell_quoting;` to testsuite/main.rs, so it actually runs
- fixed bugs in the test
@ehuss ehuss added this to the 1.29.0 milestone Feb 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

"process didn't exit successfully" output should use the same quoting as verbose command output

6 participants