Skip to content

Commit 6ca86a1

Browse files
committed
detect and handle cygwin in install::sanitize_sh
Signed-off-by: onur-ozkan <work@onurozkan.dev>
1 parent ae3703c commit 6ca86a1

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,11 @@ 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+
env::var("OSTYPE").map_or(false, |v| v.to_lowercase().contains("cygwin"))
30+
}
2731

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

0 commit comments

Comments
 (0)