about summary refs log tree commit diff
path: root/src/libstd
diff options
context:
space:
mode:
authorJack O'Connor <oconnor663@gmail.com>2018-08-15 14:07:44 -0400
committerJack O'Connor <oconnor663@gmail.com>2018-08-20 17:02:45 -0400
commit0945b74d73940e404a355eda0c8d6c202fae8a12 (patch)
tree43d6777a35a8b96ae522e18fd5f1cb1c27f2a722 /src/libstd
parent1558ae7cfd5e1190d3388dcc6f0f734589e4e478 (diff)
downloadrust-0945b74d73940e404a355eda0c8d6c202fae8a12.tar.gz
rust-0945b74d73940e404a355eda0c8d6c202fae8a12.zip
document the platform-specific behavior of Command::current_dir
Diffstat (limited to 'src/libstd')
-rw-r--r--src/libstd/process.rs10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/libstd/process.rs b/src/libstd/process.rs
index 53babd449a9..58ac4e94408 100644
--- a/src/libstd/process.rs
+++ b/src/libstd/process.rs
@@ -626,6 +626,14 @@ impl 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 @@ impl 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());