-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
fix: quote program and args in debug message from cmd::cmd(..)
#9777
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -90,13 +90,11 @@ where | |||||||||||||||||||||
| let program = program.to_executable(); | ||||||||||||||||||||||
| let args: Vec<OsString> = args.into_iter().map(Into::<OsString>::into).collect(); | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| let display_name = program.to_string_lossy(); | ||||||||||||||||||||||
| let display_args = args | ||||||||||||||||||||||
| .iter() | ||||||||||||||||||||||
| .map(|s| s.to_string_lossy()) | ||||||||||||||||||||||
| let display_command = std::iter::once(&program) | ||||||||||||||||||||||
| .chain(&args) | ||||||||||||||||||||||
| .map(|s| shell_escape::escape(s.to_string_lossy())) | ||||||||||||||||||||||
| .collect::<Vec<_>>() | ||||||||||||||||||||||
| .join(" "); | ||||||||||||||||||||||
|
Comment on lines
+93
to
97
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This code will fail to compile due to a type mismatch in the Additionally, note that this implementation constructs the
Suggested change
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
It compiles (and runs) just fine.
Yes, but the original code did the same. So I did not see a reason to change that.
Fixed by using |
||||||||||||||||||||||
| let display_command = [display_name.into(), display_args].join(" "); | ||||||||||||||||||||||
| debug!("$ {display_command}"); | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| duct::cmd(program, args) | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
Uh oh!
There was an error while loading. Please reload this page.