Skip to content

Commit fc1d2e5

Browse files
committed
detect and handle cygwin in install::sanitize_sh
Signed-off-by: onur-ozkan <[email protected]>
1 parent ae3703c commit fc1d2e5

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/bootstrap/src/core/build_steps/install.rs

+6-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,12 @@ const SHELL: &str = "sh";
2323
/// characters and on `C:\` paths, so normalize both of them away.
2424
fn sanitize_sh(path: &Path) -> String {
2525
let path = path.to_str().unwrap().replace('\\', "/");
26-
return change_drive(unc_to_lfs(&path)).unwrap_or(path);
26+
return if is_cygwin() { path } else { change_drive(unc_to_lfs(&path)).unwrap_or(path) };
27+
28+
fn is_cygwin() -> bool {
29+
// ref. https://cygwin.com/pipermail/cygwin/2022-February/250802.html
30+
env::var("OSTYPE").map_or(false, |v| v.to_lowercase().contains("cygwin"))
31+
}
2732

2833
fn unc_to_lfs(s: &str) -> &str {
2934
s.strip_prefix("//?/").unwrap_or(s)

0 commit comments

Comments
 (0)