Skip to content

Commit c7b8dc8

Browse files
committed
make shared_helpers exe function work for both cygwin and non-cygwin hosts
On Cygwin, it needs to not append .exe, because /proc/self/exe (and therefore std::env::current_exe) does not include the .exe extension, breaking bootstrap's rustc wrapper. On hosts other than Cygwin, it *does* need to append .exe because the file really does have a .exe extension, and non-Cygwin hosts won't be doing the same filename rewriting that Cygwin does when looking for a file X but finding only X.exe in its place.
1 parent bf64d66 commit c7b8dc8

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/bootstrap/src/utils/shared_helpers.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,8 @@ pub fn dylib_path() -> Vec<std::path::PathBuf> {
4646
/// Given an executable called `name`, return the filename for the
4747
/// executable for a particular target.
4848
pub fn exe(name: &str, target: &str) -> String {
49-
if target.contains("windows") {
49+
if target.contains("windows") || (cfg!(not(target_os = "cygwin")) && target.contains("cygwin"))
50+
{
5051
format!("{name}.exe")
5152
} else if target.contains("uefi") {
5253
format!("{name}.efi")

0 commit comments

Comments
 (0)