-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Update documentation for std::process::Command's new method #113787
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
Update documentation for std::process::Command's new method #113787
Conversation
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @cuviper (or someone else) soon. Please see the contribution instructions for more information. Namely, in order to ensure the minimum review times lag, PR authors and assigned reviewers should ensure that the review label (
|
I would love better documentation here but I'm also a bit reluctant to encourage people to pass We use
Basically it's only for running So, yes, I'm in favour of documenting the behaviour but I'm less certain about referencing "other executable files" because as far as |
If you don't mind, I'll let you own this review. :) r? @ChrisDenton |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For sure! As per my comment above I am generally in favour of this but have one concern.
In the current documentation, it's not specified that when creating a Command, the .exe extension can be omitted for Windows executables. However, for other types of executable files like .bat or .cmd, the complete filename including the extension must be provided. I encountered it by noticing that `Command::new("wt").spawn().unwrap()` succeeds on my machine while `Command::new("code").spawn().unwrap()` panics. Turns out VS Code's entrypoint is .cmd file. `resolve_exe` method mentions this behaviour in a comment[1], but it makes sense to mention it at more visible place. I've added this clarification to the documentation, which should make it more accurate and helpful for Rust developers working on the Windows platform. [1] https://github.com/rust-lang/rust/blob/e7fda447e7d05b6ca431fc8fe8f489b1fda810bc/library/std/src/sys/windows/process.rs#L425
@ChrisDenton thanks for the review. I have incorporated you suggestions. |
Thanks! @bors r+ rollup |
…iaskrgr Rollup of 5 pull requests Successful merges: - rust-lang#113710 (Fix rpath for libdir is specified) - rust-lang#113787 (Update documentation for std::process::Command's new method) - rust-lang#113795 (Properly document `lifetime_mapping` in `OpaqueTy`) - rust-lang#113857 (Add tests for `--document-hidden-items` option) - rust-lang#113871 (Use the correct span for displaying the line following a derive sugge…) r? `@ghost` `@rustbot` modify labels: rollup
In the current documentation, it's not specified that when creating a Command, the .exe extension can be omitted for Windows executables. However, for other types of executable files like .bat or .cmd, the complete filename including the extension must be provided.
I encountered it by noticing that
Command::new("wt").spawn().unwrap()
succeeds on my machine whileCommand::new("code").spawn().unwrap()
panics. Turns out VS Code's entrypoint is .cmd file.resolve_exe
method mentions this behaviour in a comment, but it makes sense to mention it at a more visible place.I've added this clarification to the documentation, which should make it more accurate and helpful for Rust developers working on the Windows platform.