-
Notifications
You must be signed in to change notification settings - Fork 13.3k
document the platform-specific behavior of Command::current_dir #53404
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
Conversation
r? @aidanhs (rust_highfive has picked a reviewer for you, use r? to override) |
cc @rust-lang/libs w.r.t. this question |
I would personally prefer not to document this in the sense that it makes it a larger hazard to fix in the future. Ideally we'd fix this as opposed to documenting the bug as expected behavior |
Without documenting specifics of the current behavior, maybe we should still document that the interaction (or lack thereof, either way) of |
Do we know what fix we want? This might not be specifically the ticket to discuss it, but I'm partial towards "have the Unix implementation call |
I'm not sure what sort of fix we want, but I like @SimonSapin's idea of basically documenting that this is a hazard and should likely be avoided as opposed to documenting specific behavior. |
2842027
to
0945b74
Compare
I've changed the wording and rebased:
|
@bors: r+ Thanks! |
📌 Commit 2842027f860ecd731eb0f38e28a10f9e7a8d7fa2 has been approved by |
@alexcrichton is it normal for bors to take a week to merge something? Anything I need to fix? |
@bors: r+ hm it seems bors forgot about this PR! |
📌 Commit 0945b74 has been approved by |
document the platform-specific behavior of Command::current_dir See also #37868. Here's my initial wording: > Note that if the program path is relative (e.g. `"./script.sh"`), the interaction between that path and `current_dir` varies across platforms. Windows currently ignores `current_dir` when locating the program, but Unix-like systems interpret the program path relative to `current_dir`. These implementation details aren't considered stable, and it's recommended to call `canonicalize` to get an absolute program path instead of using relative paths and `current_dir` together. I'd like to get feedback on: - _Should_ we consider those details stable? It might be disruptive to change them, regardless of what I can get away with claiming in docs :) - Is `canonicalize` an appropriate recommendation? As discussed in #37868 above, there are reasons it's not called automatically in the `Command` implementation.
☀️ Test successful - status-appveyor, status-travis |
See also #37868.
Here's my initial wording:
I'd like to get feedback on:
canonicalize
an appropriate recommendation? As discussed in std::process::Command's current_dir behaves differently on Unix and Windows, with respect to relative exe paths #37868 above, there are reasons it's not called automatically in theCommand
implementation.