From d68a5d3f3c828217c9dc66309ce82ddf848c4e56 Mon Sep 17 00:00:00 2001 From: Brad King Date: Tue, 1 Apr 2025 15:09:37 -0400 Subject: [PATCH] SystemTools: Comment why ChangeDirectory does not use UNC for long paths Issue: cmake/cmake#25936 --- SystemTools.cxx | 3 +++ 1 file changed, 3 insertions(+) diff --git a/SystemTools.cxx b/SystemTools.cxx index ef16256..463ff71 100644 --- a/SystemTools.cxx +++ b/SystemTools.cxx @@ -329,6 +329,9 @@ inline char const* Getcwd(char* buf, unsigned int len) } inline int Chdir(std::string const& dir) { + // We cannot use ToWindowsExtendedPath here because that causes a + // UNC path to be recorded as the process working directory, and + // can break child processes. return _wchdir(KWSYS_NAMESPACE::Encoding::ToWide(dir).c_str()); } inline void Realpath(std::string const& path, std::string& resolved_path, -- GitLab