diff --git a/src/bootstrap/src/core/build_steps/install.rs b/src/bootstrap/src/core/build_steps/install.rs index 0ce86eadbce67..8551bd24acf77 100644 --- a/src/bootstrap/src/core/build_steps/install.rs +++ b/src/bootstrap/src/core/build_steps/install.rs @@ -23,7 +23,12 @@ const SHELL: &str = "sh"; /// characters and on `C:\` paths, so normalize both of them away. fn sanitize_sh(path: &Path) -> String { let path = path.to_str().unwrap().replace('\\', "/"); - return change_drive(unc_to_lfs(&path)).unwrap_or(path); + return if is_cygwin() { path } else { change_drive(unc_to_lfs(&path)).unwrap_or(path) }; + + fn is_cygwin() -> bool { + // ref. https://cygwin.com/pipermail/cygwin/2022-February/250802.html + env::var("OSTYPE").map_or(false, |v| v.to_lowercase().contains("cygwin")) + } fn unc_to_lfs(s: &str) -> &str { s.strip_prefix("//?/").unwrap_or(s)