From 0945b74d73940e404a355eda0c8d6c202fae8a12 Mon Sep 17 00:00:00 2001 From: Jack O'Connor Date: Wed, 15 Aug 2018 14:07:44 -0400 Subject: [PATCH] document the platform-specific behavior of Command::current_dir --- src/libstd/process.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/libstd/process.rs b/src/libstd/process.rs index 53babd449a992..58ac4e944087e 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>(&mut self, dir: P) -> &mut Command { self.inner.cwd(dir.as_ref().as_ref());