]> git.lizzy.rs Git - rust.git/commitdiff
Document `std::env::current_exe` rename behaviour
authorChris Denton <ChrisDenton@users.noreply.github.com>
Fri, 27 Aug 2021 13:25:29 +0000 (14:25 +0100)
committerGitHub <noreply@github.com>
Fri, 27 Aug 2021 13:25:29 +0000 (14:25 +0100)
It might not be obvious that the "path of the current running executable" may (or may not) mean "at the time it was loaded".

library/std/src/env.rs

index a7465200955595eb463a178823e147a325fc4a1f..e343073d2150879d87cab768a35cece48d98510f 100644 (file)
@@ -616,6 +616,9 @@ pub fn temp_dir() -> PathBuf {
 /// return the path of the symbolic link and other platforms will return the
 /// path of the symbolic link’s target.
 ///
+/// If the executable is renamed while it is running, platforms may return the
+/// path at the time it was loaded instead of the new path.
+///
 /// # Errors
 ///
 /// Acquiring the path of the current executable is a platform-specific operation