]> git.lizzy.rs Git - rust.git/commitdiff
document the platform-specific behavior of Command::current_dir
authorJack O'Connor <oconnor663@gmail.com>
Wed, 15 Aug 2018 18:07:44 +0000 (14:07 -0400)
committerJack O'Connor <oconnor663@gmail.com>
Mon, 20 Aug 2018 21:02:45 +0000 (17:02 -0400)
src/libstd/process.rs

index 53babd449a992fbfe5653a67b1e3d36525cafdd3..58ac4e944087ee7416e2ed36e4a832f9497545b2 100644 (file)
@@ -626,6 +626,14 @@ pub fn env_clear(&mut self) -> &mut Command {
 
     /// Sets the working directory for the child process.
     ///
+    /// # Platform-specific behavior
+    ///
+    /// If the program path is relative (e.g. `"./script.sh"`), it's ambiguous
+    /// whether it should be interpreted relative to the parent's working
+    /// directory or relative to `current_dir`. The behavior in this case is
+    /// platform specific and unstable, and it's recommended to use
+    /// [`canonicalize`] to get an absolute program path instead.
+    ///
     /// # Examples
     ///
     /// Basic usage:
@@ -638,6 +646,8 @@ pub fn env_clear(&mut self) -> &mut Command {
     ///         .spawn()
     ///         .expect("ls command failed to start");
     /// ```
+    ///
+    /// [`canonicalize`]: ../fs/fn.canonicalize.html
     #[stable(feature = "process", since = "1.0.0")]
     pub fn current_dir<P: AsRef<Path>>(&mut self, dir: P) -> &mut Command {
         self.inner.cwd(dir.as_ref().as_ref());